我应该使用< p />标记中的标记? [英] Should I use the <p /> tag in markup?

查看:90
本文介绍了我应该使用< p />标记中的标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用< br /> < div /> 标签时,



使用< p /> 标签仍然值得鼓励吗?


  • 使用< p>< / p> 在文档中包含一段文字。 使用< br /> 来指示段落内的换行符 段落(即没有段落块边距或填充的新行)。 b
  • 使用< div>< / div> 来包含恰好有块布局的应用程序用户界面



不要使用< div /> < p /> 本身,这些标签是为了包含内容。它们看起来像段落中断一样工作,只是因为当浏览器看到它们时,它会在打开空白块之前帮助关闭当前块标记。


I have always used either <br /> or a <div/> tag when something more advanced is necessary.

Is use of the <p/> tag still encouraged?

解决方案

Modern HTML semantics are:

  • Use <p></p> to contain a paragraph of text in a document.
  • Use <br /> to indicate a line break inside a paragraph (i.e. a new line without the paragraph block margins or padding).
  • Use <div></div> to contain a piece of application UI that happens to have block layout.

Don't use <div /> or <p /> on its own, those tags are meant to contain content. They appear to work as paragraph breaks only because when the browser sees them, it "helpfully" closes the current block tag before opening the empty one.

这篇关于我应该使用&lt; p /&gt;标记中的标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆