Are nested span tags OK in XHTML?

后端 未结 3 1703
-上瘾入骨i
-上瘾入骨i 2020-12-05 01:43

Will this validate in XHTML?

helloworld
相关标签:
3条回答
  • 2020-12-05 02:08

    Absolutely.

    Here's the definition from an XHTML-strict DOCTYPE for a span element.

    <!ELEMENT span %Inline;> <!-- generic language/style container -->
    <!ATTLIST span
      %attrs;
      >
    

    The "%Inline" part tells me that it can have child nodes from the "% Inline;" entities element list.

    The span element is included in the list of elements classed as "% Inline", that combined with span allowing "%Inline" child elements tells me that span is a valid child of span.

    0 讨论(0)
  • 2020-12-05 02:15

    Yes it will. You can help yourself by using the w3's validator direct input option:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
            <head>
              <title>Title</title>
            </head>
    
            <body>
               <p>
                   <span>Test<span>Nest span</span></span>
               </p>
            </body>
          </html>
    
    0 讨论(0)
  • 2020-12-05 02:19

    SPAN can contain only inline elements, such as SPAN etc.

    0 讨论(0)
提交回复
热议问题