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

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

问题描述

当需要更高级的东西时,我总是使用 <br/><div/> 标签.

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

是否仍鼓励使用 <p/> 标签?

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

推荐答案

现代 HTML 语义有:

Modern HTML semantics are:

  • 使用 <p></p> 在文档中包含一段文本.
  • 使用 <br/> 表示段落的换行符(即没有段落块边距或填充的新行).
  • 使用 <div></div> 包含一块恰好具有块布局的应用程序 UI.
  • 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.

不要单独使用 <div/><p/>,这些标签是用来包含内容的.它们似乎只是作为段落分隔符起作用,因为当浏览器看到它们时,它会有用地"关闭当前块标签,然后再打开空标签.

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天全站免登陆