美文网首页
[html]span里面放div会带来严重问题

[html]span里面放div会带来严重问题

作者: 清水芦苇 | 来源:发表于2017-07-27 16:39 被阅读50次

    If you use the W3C Validator to check a simple document:

    <!DOCTYPE html> 
    <html lang="en">    
    <head>      
     <title>Title</title>      
     <meta charset="utf-8">    
    </head>   
    <body>      
    <span>         
        <div><p>Some text</p></div>         Some text      
    </span>   
    </body></html>
    

    it does not report an error when validating it as HTML5. If you set the doctype to "HTML 4.01 Transitional" it does. Perhaps this is just because the HTML5 validation is experimental?
    The html5.validator.nu service does report an error however

    参考文献

    1. http://stackoverflow.com/questions/2919909/nesting-div-within-span-problem
    2. http://diophung.blogspot.jp/2014/03/web-developer-conform-to-w3c-standards.html
    3. http://doctype.com/span-contain-div-html5
    4. https://www.w3.org/wiki/Generic_containers_-_the_div_and_span_elements
    5. https://www.w3.org/TR/html401/struct/global.html#h-7.5.3

    相关文章

      网友评论

          本文标题:[html]span里面放div会带来严重问题

          本文链接:https://www.haomeiwen.com/subject/pbntottx.html