HTML:
<div class="image-container">
<img src="http://s6.picofile.com/file/8228890334/city_h_c_301_444_9.jpg" width="200px" height="300px" />
<div class="after">Put your contetnt here</div>
</div>
CSS:
.image-container {
position: relative;
width: 200px;
height: 300px;
}
.image-container .after {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
color: #FFF;
}
.image-container:hover .after {
display: block;
transition:all 0.2s ease;
background: rgba(0, 0, 0, .6);
}
結果:Overlay
其他的解決方案是,期運用CSS filter.such作爲Filter Functions
。
Exmple:
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/392/redwood-ukulele-top.jpg" alt="ukulele">
CSS:
img { display: block; width: 90%; }
img {
-webkit-filter: sepia(1);
filter: sepia(1);
}
和效果:Filter Functions
閱讀更多相關資訊here
圖片不再存在,但可以看看[這裏](https://css-tricks.com/almanac// F /過濾/)上手性... – segFault
已經看了那篇文章。沒有太大的幫助。我更換了形象:http://i.imgur.com/4XK9J6G.png – user5685147