<figure>ï¼å¯éæ é¢å 容å ç´
åºçº¿
广æ³å¯ç¨
èª 2015å¹´7æ èµ·ï¼æ¤ç¹æ§å·²å¨ä¸»æµæµè§å¨ä¸å¾å°æ¯æï¼å¯å¨å¤§å¤æ°è®¾å¤åæµè§å¨çæ¬ä¸æ£å¸¸ä½¿ç¨ã
HTML <figure> å
ç´ ä»£è¡¨ä¸æ®µç¬ç«çå
容ï¼å¯è½å
å« <figcaption> å
ç´ å®ä¹ç说æå
ç´ ã该æå¾ãæ é¢åå
¶ä¸çå
容é常ä½ä¸ºä¸ä¸ªç¬ç«çå¼ç¨åå
ã
å°è¯ä¸ä¸
<figure>
<img
src="/shared-assets/images/examples/elephant.jpg"
alt="Elephant at sunset" />
<figcaption>An elephant at sunset</figcaption>
</figure>
figure {
border: thin #c0c0c0 solid;
display: flex;
flex-flow: column;
padding: 5px;
max-width: 220px;
margin: auto;
}
img {
max-width: 220px;
max-height: 150px;
}
figcaption {
background-color: #222;
color: #fff;
font: italic smaller sans-serif;
padding: 3px;
text-align: center;
}
| å 容åç±» | æµå¼å 容ã 坿ç¥å 容 |
|---|---|
| å 许çå 容 |
<figcaption> å
ç´ ï¼ä¸ç´§éçæµå¼å
å®¹ï¼æç´§éæµå¼å
容ç <figcaption> å
ç´ ï¼ææµå¼å
容ã
|
| æ ç¾çç¥ | ä¸å 许ï¼å¼å§æ ç¾åç»ææ ç¾é½ä¸è½çç¥ã |
| å 许çç¶å ç´ | æææ¥åæµå¼å 容çå ç´ |
| æç¡®ç ARIA è§è² | figure |
| å 许ç ARIA è§è² | æ å figcaption å ç´ ï¼anyï¼å¦å没æå 许çè§è² |
| DOM æ¥å£ | HTMLElement |
屿§
æ¤å ç´ åªå å«å ¨å±å±æ§ã
使ç¨è¯´æ
- é常ï¼
<figure>çå 容为å¾åãæå¾ãå¾è¡¨ã代ç çæ®µçï¼å¨ææ¡£ç主å 容æµä¸å¼ç¨ï¼ä½å¯ä»¥ç§»å¨å°ææ¡£çå¦ä¸é¨åæéå½èä¸å½±å主å 容æµã - éè¿å¨å
¶ä¸æå
¥
<figcaption>ï¼ä½ä¸ºç¬¬ä¸ä¸ªææåä¸ä¸ªåå ç´ ï¼ï¼å¯ä»¥å°æ é¢ä¸<figure>å ç´ ç¸å ³èãå¾ä¸æ¾å°ç第ä¸ä¸ª<figcaption>å ç´ æ¾ç¤ºä¸ºå¾çæ é¢ã
示ä¾
>å¾å
html
<!-- åªæå¾å -->
<figure>
<img
src="/zh-CN/docs/Web/HTML/Element/figure/favicon-192x192.png"
alt="The beautiful MDN logo." />
</figure>
<!-- ææ é¢çå¾å -->
<figure>
<img
src="/zh-CN/docs/Web/HTML/Element/figure/favicon-192x192.png"
alt="The beautiful MDN logo." />
<figcaption>MDN Logo</figcaption>
</figure>
ä»£ç æ®µ
html
<figure>
<figcaption>ä½¿ç¨ <code>navigator</code> è·åæµè§å¨çä¿¡æ¯ã</figcaption>
<pre>
function NavigatorExample() {
var txt;
txt = "Browser CodeName: " + navigator.appCodeName + "; ";
txt+= "Browser Name: " + navigator.appName + "; ";
txt+= "Browser Version: " + navigator.appVersion + "; ";
txt+= "Cookies Enabled: " + navigator.cookieEnabled + "; ";
txt+= "Platform: " + navigator.platform + "; ";
txt+= "User-agent header: " + navigator.userAgent + "; ";
console.log("NavigatorExample", txt);
}
</pre>
</figure>
å¼ç¨
html
<figure>
<figcaption><b>Edsger Dijkstra:</b></figcaption>
<blockquote>
If debugging is the process of removing software bugs, then programming must
be the process of putting them in.
</blockquote>
</figure>
è¯æ
html
<figure>
<p style="white-space:pre">
Bid me discourse, I will enchant thine ear, Or like a fairy trip upon the
green, Or, like a nymph, with long dishevelled hair, Dance on the sands, and
yet no footing seen: Love is a spirit all compact of fire, Not gross to
sink, but light, and will aspire.
</p>
<figcaption><cite>Venus and Adonis</cite>, by William Shakespeare</figcaption>
</figure>
è§è
| è§è |
|---|
| HTML > # the-figure-element > |
æµè§å¨å ¼å®¹æ§
åè§
<figcaption>å ç´