【发布时间】:2015-03-20 18:40:40
【问题描述】:
所以我有一张需要hover 效果的图片;
HTML
<div class="data">
<img src="http://scontent-a-dfw.cdninstagram.com/hphotos-xpa1/t51.2885-15/e15/10809512_341410899374744_4010362_n.jpg"/>
<div class="overlay"></div>
</div>
CSS
.data {
width: 100px;
margin: auto;
padding: 5px;
height: auto;
}
img {
width: 100%;
}
.overlay {
width: 100%;
height: ___?;
background-color: blue;
}
如您所见,.data 的高度与图像相同。我怎样才能使.overlay 与height 相同.data?
【问题讨论】: