gpt4 book ai didi

html - 使 可选的空格字符限制

转载 作者:太空狗 更新时间:2023-10-29 15:57:35 26 4
gpt4 key购买 nike

HTML5 引用 states :

A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment.

这个“空格字符”限制是什么意思?我只能认为像

<title>My Page</title><p>Some stuff.</p>

有效,而

<title>My Page</title>
<p>Some stuff.</p>

不是,因为隐式 </head><body>标签不会包围换行符。但我觉得我离题了。一个澄清的例子将不胜感激。

感谢大家!

最佳答案

这只是意味着由于注释和空格字符可能出现在head元素内部,它们不会隐式地结束head元素。

因此,如果您想要(例如)在 head 元素关闭之后而不是就在它关闭之前的注释,那么您必须使用显式的 </head>

</title> <!-- foo --> <body>

意思是一样的

</title> <!-- foo --> </head><body>

而且没有办法表示

</title></head> <!-- foo --> <body>

不使用明确的 </head>

关于html - 使 </head> 可选的空格字符限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10800662/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com