Why is the

后端 未结 5 1034
太阳男子
太阳男子 2020-11-27 19:04

For curiosities sake, why is the <img> tag not closed in HTML?

\"Smiley

        
5条回答
  •  无人及你
    2020-11-27 19:21

    It is what is called a void element which just means the element must not have any content (but can have attributes.) The HTML5 spec has this to say about void elements:

    if the element is one of the void elements, or if the element is a foreign element, then there may be a single "/" (U+002F) character. This character has no effect on void elements

    So there's no real reason to have the single "/" (U+002F) character, but it won't break anything if it's included.

提交回复
热议问题