简体   繁体   English

XHTML严格:p标签内的br标签

[英]XHTML Strict: br tag inside p tag

I get lots of validation errors because of <br /> inside <p>. 由于<p>内的<br />,我得到了很多验证错误 If I remove the br tags then it works fine. 如果我删除br标签,那么它工作正常。

Why is it creating a problem? 为什么会产生问题?

It's not that the br is inside the p , but rather you're not ending the br with the / character. 这不是brp ,而是你没有用/字符结束br You have <br> in the code, when it should be <br/> . 你有代码中的<br> ,它应该是<br/> Which is why the validation error is "end tag for "br" omitted", it's telling you that you've not ended the tag correctly with a /. 这就是为什么验证错误是“结束标记为”br“省略”,它告诉您没有使用/正确结束标记。

Note that in HTML4 it's not required to close the br tag with a final slash, but in XHTML it is required as it's a singleton tag. 请注意,在HTML4中,不需要使用最终斜杠关闭br标记,但在XHTML中它是必需的,因为它是单例标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM