<分区>
</p>
仅在 XHTML 中需要,但在 HTML 中不需要。有时您无论如何都必须关闭它,例如当您将段落左/右/居中对齐时。
将混合使用 </p>
如下所示是个坏主意吗?请注意,没有结尾 </p>
在第 1 段和第 3 段中标记。
<h1>My article</h1>
<p>This is my 1st paragraph.
<p class="align=right">This is my 2nd paragraph</p>
<p>This is my 3rd paragraph.
不想关闭P标签的原因:
- 易于在我的 CMS 中使用(要求更高的代码才能使其成为 XHTML)
- 1kb 较轻的文件
P-end-tag is only required in XHTML, not in HTML.
正确
But some times you have to close it any way eg. when you align the paragraph left/right/center.
不正确。唯一需要显式结束标记的情况是当您想要结束段落并紧跟其后的段落内允许的内容(例如文本或内联元素)时。这通常是个坏主意。
Would it for any reason be a bad idea to mix the usage of P-end-tag
只有一致性才是有助于代码维护的美德。