HTML使用figure元素插入图表、照片、图形、插图、代码片段等,figcaption是figure的标题,可选,出现在figure内容的开头或结尾处。
<body>
I like apples and oranges.
<figure>
<figcaption>Listing 23. Using the code element</figcaption>
<code>var fruits = ["apples", "oranges", "mangoes", "cherries"];<br>document.writen("I like " + fruits.length + " fruits");
</code>
</figure>
You can see other fruits I like <a href="fruitlist.html">here</a>.
</body>
figure元素生成了一个将code元素裹在其中的插图,并用figcaption元素为其添加了一个标题。注意figcaption元素必须是figure元素的第一个或最后一个子元素。
figure元素可以包含多个内容块,但只能包含一个figcaption。