我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
The HTML <p>
element (or HTML Paragraph Element) represents a paragraph of text. Paragraphs are usually represented in visual media as blocks of text that are separated from adjacent blocks by vertical blank space and/or first-line indentation. The paragraph must be closed at end of the text "<p> text </p>" are requried to put the text between the paragraph. Paragraphs are block-level elements.
Content categories | Flow content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | The start tag is mandatory. The end tag may be omitted if the <p> element is immediately followed by an <address> , <article> , <aside> , <blockquote> , <div> , <dl> , <fieldset> , <footer> , <form> , <h1> , <h2> , <h3> , <h4> , <h5> , <h6> , <header> , <hr> , <menu> , <nav> , <ol> , <pre> , <section> , <table> , <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element. |
Permitted parent elements | Any element that accepts flow content. |
DOM interface | HTMLParagraphElement |
Attributes
This element includes the global attributes.
The align
attribute on <p>
is obsolete. Do not use it.
Example
<p>This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.</p> <p>This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.</p>
This produces:
Notes
To change gaps between paragraphs, use the CSS margin
property. Do not insert empty paragraphs elements or <br>
between them.
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<p>' in that specification. |
Living Standard | No change since the latest W3C snapshot HTML5 |
HTML5 The definition of '<p>' in that specification. |
Recommendation | align attribute is obsolete |
HTML 4.01 Specification The definition of '<p>' in that specification. |
Recommendation | Initial definition |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) |
See also
文件標籤與貢獻者
標籤:
此頁面的貢獻者:
prabhatanche,
Tigt,
jswisher,
gnardell,
teoli,
Sebastianz,
shamimahsan600,
Sheppy,
kscarfone,
pablofiumara,
justleroy,
ethertank,
odraencoded,
tregagnon,
medicdude,
iamjessklein,
Bzbarsky,
cers,
hobophobe,
McGurk,
osdm,
fscholz,
Mgjbot,
PablO
最近更新:
prabhatanche,