很多时候,我们需要在页面中插入图片,并且还需要对图片进行一个简单的说明,那么这时候,我们就可以使用figure语义元素。具体代码如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.content{
width: 1000px;
margin:0 auto;
}
.FloatFigure{
margin-right: 20px;
float: left;
}
.FloatFigure figcaption{
max-width: 200px;
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="content">
<figure class="FloatFigure">
<img src="test.png" alt="">
<figcaption>这是图片</figcaption>
</figure>
</div>
</body>
</html>