HTML <figure> 标籤
- หน้าก่อนหน้า <figcaption>
- หน้าต่อไป <font>
定义和用法
<figure>
标签规定自包含的内容,如插图、图表、照片、代码清单等。
虽然 <figure>
元素的内容与主要内容相关,但它的位置独立于主要内容流,如果删除它,不应影响文档流。
提示:請使用 <figcaption> 元素 為 <figure>
元素添加標題。
另請參考:
HTML DOM 參考手冊:Figure 對象
實例
例子 1
使用 <figure> 元素標記文檔中的照片,使用 <figcaption> 元素定義照片的標題:
<figure> <img src="trulli.jpg" alt="Trulli" style="width:100%"> <figcaption>圖 1 - 伊大利普里亞地區的 Trulli。</figcaption> </figure>
例子 2
使用 CSS 設置 <figure> 和 <figcaption> 的樣式:
<html> <head> <style> figure { border: 1px #cccccc solid; padding: 4px; margin: auto; } figcaption { background-color: black; color: white; font-style: italic; padding: 2px; text-align: center; } </style> </head> <body> <figure> <img src="trulli.jpg" alt="Trulli" style="width:100%"> <figcaption>圖 1 - 伊大利普里亞地區的 Trulli。</figcaption> </figure> </body> </html>
ขอบเขตเหตุการณ์
<figure>
ตามตารางนี้ยังสนับสนุน ขอบเขตเหตุการณ์ทั่วไปใน HTML.
ขอบเขตเหตุการณ์
<figure>
ตามตารางนี้ยังสนับสนุน ขอบเขตเหตุการณ์ใน HTML.
การตั้งค่า CSS โรมัน
โปรแกรมบราวเซอร์ส่วนใหญ่จะแสดงค่าในรูปแบบที่แสดงด้านล่าง <figure>
องค์ประกอบ:
figure { display: block; margin-top: 1em; margin-bottom: 1em; margin-left: 40px; margin-right: 40px; }
การสนับสนุนโปรแกรมบราวเซอร์
ตัวเลขในตารางนี้บอกว่าเวอร์ชั่นแรกที่สนับสนุนอิเล็กทรอนิกส์อิสระ
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
8.0 | 9.0 | 4.0 | 5.1 | 11.0 |
หมายเหตุ:<figure> สมาชิก HTML 5 ที่ใหม่
- หน้าก่อนหน้า <figcaption>
- หน้าต่อไป <font>