使用插图
HTML5对插图的定义为:一个独立的内容单元,可带标题,通常作为一个整体被文档的主体引用,把它从文档主体中删除也不会影响文档的含义。
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。









