選單
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <p> 標籤


示例

段落標記如下:

<p>This is some text in a paragraph.</p>
自己動手試一試 »

更多“自己嘗試”的例子見下文。


定義和用法

The <p> tag defines a paragraph.

Browsers automatically add a single blank line before and after each <p> element.

Tip: Use CSS to style paragraphs.


瀏覽器支援

元素
<p>

全域性屬性

The <p> tag also supports the Global Attributes in HTML.


事件屬性

The <p> tag also supports the Event Attributes in HTML.



更多示例

示例

Align text in a paragraph (with CSS)

<p style="text-align:right">This is some text in a paragraph.</p>
自己動手試一試 »

示例

Style paragraphs with CSS

<html>
<head>
<style>
p {
  color: navy;
  text-indent: 30px;
  text-transform: uppercase;
}
</style>
</head>
<body>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

</body>
</html>
自己動手試一試 »

示例

 More on paragraphs

<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>
自己動手試一試 »

示例

Poem problems in HTML

<p>
My Bonnie lies over the ocean.
My Bonnie lies over the sea.
My Bonnie lies over the ocean.
Oh, bring back my Bonnie to me.
</p>
自己動手試一試 »

相關頁面

HTML 教程:HTML 段落

HTML DOM reference: Paragraph Object


預設 CSS 設定

Most browsers will display the <p> element with the following default values

示例

p {
  display: block;
  margin-top: 1em;
  margin-bottom: 1em;
  margin-left: 0;
  margin-right: 0;
}
自己動手試一試 »


×

聯絡銷售

如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com

報告錯誤

如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com

W3Schools 經過最佳化,旨在方便學習和培訓。示例可能經過簡化,以提高閱讀和學習體驗。教程、參考資料和示例會不斷審查,以避免錯誤,但我們無法保證所有內容的完全正確性。使用 W3Schools 即表示您已閱讀並接受我們的使用條款Cookie 和隱私政策

版權所有 1999-2024 Refsnes Data。保留所有權利。W3Schools 由 W3.CSS 提供支援