Which tags can be closed independently and which of them should have a closed tag in XHTML 1.0 Strict?

Which tags can be closed independently and which of them should have a closed tag in XHTML 1.0 Strict?

Example:

<br/> <input /> 

Are there certain tags that must have a private tag that can be closed by the user, or does eigther work in XHTML 1.0 Strict?

+4
source share
2 answers

Each element, this EMPTY content model in XHTML 1.0 Strict DTD (ie <!ELEMENT element-name EMPTY> ), is an empty element , and "must either have an end tag, or the start tag must end with /> ". Namely, its base , meta , link , hr , br , param , img , area and input . Every other element must have an end tag.

+6
source

You are asking about "EMPTY Elements", including <hr /> <input /> <img /> <meta /> <link /> , which can be closed in a single tag. Non-empty elements that must contain text or sub-elements can be technically closed in this way if they do not have a child or text, but you should not. For example, <p></p> should not be <p /> , but this can lead to strict verification.

http://www.w3.org/TR/xhtml1/#guidelines

+2
source

Source: https://habr.com/ru/post/1344849/


All Articles