HTML5实例教程:figure标签使用实例
figure元素是一种元素的组合,可带有标题(可选)。figure标签用来表示网页上一块独立的内容,将其从网页上移除后不会对网页上的其他内容产生影响。figure所表示的内容可以是图片、统计图或代码示例。
figure用友一个子标签——figcaption标签。
注意:一个figure元素内最多只允许放置一个figcaption元素,其他元素可无限放置。
案例1:不带有标题的figure元素:
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HTML5每日一练之figure新标签的应用-不带有标题的figure元素</title>
- </head>
- <body>
- <figure>
- <img alt="WEBJX.COM" src="http://www.WEBJX.com/template/w3cfuns2011/images/logo/logo.png"/>
- </figure>
- </body>
- </html>
案例2:带有标题的figure元素:
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HTML5每日一练之figure新标签的应用-带有标题的figure元素</title>
- </head>
- <body>
- <figure>
- <img alt="phpstudy.net" src="http://www.phpstudy.net/template/w3cfuns2011/images/logo/logo.png"/>
- <figcaption>WEBJX.COM</figcaption>
- </figure>
- </body>
- </html>
案例3:多个图片,同一个标题的figure元素:
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>HTML5每日一练之figure新标签的应用-多个图片,同一个标题的figure元素</title>
- </head>
- <body>
- <figure>
- <img alt="WEBJX.COM" src="http://www.phpstudy.net/images/logo.gif" />
- <img alt="网页教学网" src="http://www.phpstudy.net/images/common/Logo.gif"/>
- <img alt="网页教学网" src="http://www.phpstudy.net/images/bigLogo.jpg"/>
- <figcaption>网页教学网--中国网页设计,网页制作第一站!</figcaption>
- </figure>
- </body>
- </html>
«
»