.test5:hover figcaption p{opacity: 1;}
.test5:hover figcaption h2{opacity: 1;}
.test5:hover img{opacity: 0.6;}
<!--井字格-->
<figure class="test5">
<img src="img/altimg05.jpg">
<figcaption>
<h2>图片标题</h2>
<p>这里是图片的相关描述内容</p>
<div class="div01"></div>
<div class="div02"></div>
</figcaption>
</figure>以上是几个简单的小例子,之所以用figure和figcaption标签,主要是标签的语义化,截取动态图用到的是GifCam第一次用 挺好用的 很可爱 哈哈。
figure标签主要是用于规定独立的流内容(图片,图表,照片,代码等)而figcaption与figure标签配套使用,主要用于定义figure元素的标题
哦,对了,由于这几个例子写在一个html里面 所以提取出了部分公用的样式
body,figure,figcaption,h2,p{margin:0;padding:0;font-family: "微软雅黑";}
figure{position: relative;overflow: hidden;float: left;width:33.33%;height: 350px;}
figcaption{position: absolute;top: 0;left: 0;color:#fff;}
figure img{width:101%;height: 360px;opacity: 0.8;transition: all 0.35s}
figure figcaption p,h2,span,div{transition: all 0.35s}
@media screen and (max-width: 600px) {
figure{width: 100%;}
}
@media screen and (min-width:601px) and (max-width: 1000px) {
figure{width: 50%;}
}
@media screen and (min-width: 1001px) {
figure{width: 33.33%;}
}总结:
之所以选择写博客主要是为了锻炼自己的表达能力,培养一个总结知识点的好习惯,以前看别人写的一些好的文章时都很羡慕,自己却总是不知道从何下手,直到最近投简历的时候发现很多公司都要求注明自己的博客地址,所以有必要逼着自己写一下东西啦!










