<p>ï¼æ®µè½å ç´
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015å¹´7æ.
<p> HTML å
ç´ ä»£è¡¨ä¸å段è½ãå¨è¦è¦ºåªé«ä¸ï¼æ®µè½é常被表示çºç±ç©ºç½è¡å/æé¦è¡ç¸®æåéçææ¬åå¡ï¼ä½ HTML 段è½å¯ä»¥æ¯ä»»ä½ç¸éå
§å®¹ççµæ§åçµï¼ä¾å¦åçæè¡¨å®å段ã
æ®µè½æ¯åå¡ç´å
ç´ ï¼ç¹å¥æ¯å¨è§£æäºçµæç </p> æ¨è¨ä¹åï¼å¦æè§£æäºå¦ä¸ååå¡ç´å
ç´ ï¼åæ®µè½æèªåééãåè¦ä¸é¢çãæ¨ç±¤çç¥ãã
å試ä¸ä¸
<p>
Geckos are a group of usually small, usually nocturnal lizards. They are found
on every continent except Antarctica.
</p>
<p>
Some species live in houses where they hunt insects attracted by artificial
light.
</p>
p {
margin: 10px 0;
padding: 5px;
border: 1px solid #999;
}
屬æ§
æ¤å ç´ å å å«å ¨å屬æ§ã
å註ï¼<p> æ¨ç±¤ä¸ç align 屬æ§å·²éæï¼ä¸æä½¿ç¨ã
ç¯ä¾
>HTML
<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 the second paragraph. This is the second paragraph. This is the second
paragraph. This is the second paragraph.
</p>
çµæ
è¨è¨æ®µè½æ¨£å¼
é è¨æ æ³ä¸ï¼ç覽å¨ä½¿ç¨å®å空ç½è¡åéæ®µè½ãå¯ä»¥ä½¿ç¨ CSS 實ç¾å ¶ä»åéæ¹æ³ï¼ä¾å¦é¦è¡ç¸®æï¼
HTML
<p>
Separating paragraphs with blank lines is easiest for readers to scan, but
they can also be separated by indenting their first lines. This is often used
to take up less space, such as to save paper in print.
</p>
<p>
Writing that is intended to be edited, such as school papers and rough drafts,
uses both blank lines and indentation for separation. In finished works,
combining both is considered redundant and amateurish.
</p>
<p>
In very old writing, paragraphs were separated with a special character: ¶,
the <i>pilcrow</i>. Nowadays, this is considered claustrophobic and hard to
read.
</p>
<p>
How hard to read? See for yourself:
<button data-toggle-text="Oh no! Switch back!">
Use pilcrow for paragraphs
</button>
</p>
CSS
p {
margin: 0;
text-indent: 3ch;
}
p.pilcrow {
text-indent: 0;
display: inline;
}
p.pilcrow + p.pilcrow::before {
content: " ¶ ";
}
JavaScript
document.querySelector("button").addEventListener("click", (event) => {
document.querySelectorAll("p").forEach((paragraph) => {
paragraph.classList.toggle("pilcrow");
});
[event.target.innerText, event.target.dataset.toggleText] = [
event.target.dataset.toggleText,
event.target.innerText,
];
});
çµæ
å¯åæ§æ³¨æäºé
å°å §å®¹åææ®µè½æå©æ¼ä½¿é 颿´å ·å¯è¨ªåæ§ãå±å¹é±è®å¨åå ¶ä»è¼å©æè¡æä¾å¿«æ·æ¹å¼ï¼è®å ¶ç¨æ¶å¯ä»¥è·³éå°ä¸ä¸åæä¸ä¸å段è½ï¼ä½¿ä»åå¯ä»¥åè¦è¦ºç¨æ¶ä¸æ¨£å¿«éçè¦½å §å®¹ã
使ç¨ç©ºç <p> å
ç´ æ·»å æ®µè½ä¹éçç©ºæ ¼å°æ¼ä½¿ç¨å±å¹é±è®æè¡ç人ä¾èªªæ¯æåé¡çãå±å¹é±è®å¨å¯è½æå®£å該段çåå¨ï¼ä½ä¸æå®£åå
¶ä¸å
å«çä»»ä½å
§å®¹ â å çºæ²æå
§å®¹ãéå¯è½æè®ä½¿ç¨å±å¹é±è®å¨ç人æå°å°æåæ²®åªã
妿叿å¢å é¡å¤ç空éï¼å¯ä»¥ä½¿ç¨ CSS 屬æ§ï¼ä¾å¦ marginï¼
p {
margin-bottom: 2em; /* 卿®µè½ä¹å¾å¢å ç½è²ç©ºé */
}
æè¡æ¦è¦
| å §å®¹é¡å | æµå §å®¹ãæ«åå §å®¹ã |
|---|---|
| å 許çå §å®¹ | 段è½åå §å®¹ã |
| æ¨ç±¤çç¥ |
å¿
é æèµ·å§æ¨ç±¤ã妿 <p> å
ç´ ççµææ¨ç±¤ä¹å¾ç·æ¥èçæ¯
<address>ã<article>ã<aside>ã<blockquote>ã<details>ã<div>ã<dl>ã<fieldset>ã<figcaption>ã<figure>ã<footer>ã<form>ãh1ãh2ãh3ãh4ãh5ãh6ã<header>ã<hgroup>ã<hr>ã<main>ã<menu>ã<nav>ã<ol>ã<pre>ã<search>ã<section>ã<table>ã<ul> æå¦ä¸å <p> å
ç´ ï¼æè
妿ç¶å
ç´ ä¸æ²ææ´å¤å
§å®¹ï¼ä¸ç¶å
ç´ ä¸æ¯ <a>ã<audio>ã<del>ã<ins>ã<map>ã<noscript> æ <video> å
ç´ ï¼æè
æ¯ç¨ç«çèªå®ç¾©å
ç´ ï¼åå¯ä»¥çç¥çµææ¨ç±¤ã
|
| å 許çç¶å ç´ | 任使¥åæµå §å®¹çå ç´ ã |
| é±å« ARIA è§è² | paragraph |
| å 許ç ARIA è§è² | ä»»ä½ |
| DOM ä»é¢ | HTMLParagraphElement |
è¦ç¯
| Specification |
|---|
| HTML > # the-p-element > |