我试图拼凑在缩略图的右下角基本上改造YouTube的缩略图,时间戳,就像这样:股利另一个DIV的顶部
然而,我似乎无法弄清楚如何将时间戳放在图像的顶部,然后正确定位。
这里的的jsfiddle:http://jsfiddle.net/MgcDU/4162/
HTML:
<div class="container">
<div class="small-video-section">
<div class="thumbnail-container">
<img src="http://i2.ytimg.com/vi/yKWoPlL2B8I/mqdefault.jpg" width="220" />
</div>
<div class="thumbnail-time">
5:42
</div>
</div>
</div>
CSS:
.small-video-section {
height: 134px;
}
.thumbnail-container {
margin-top: 15px;
margin-right: 20px;
}
.thumbnail-last {
margin-top: 15px;
}
.thumbnail-time {
display: inline;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 12px;
color: #ffffff;
background-color: #000000;
opacity: 0.8;
padding: 2px 4px 2px 4px;
}
请帮帮忙!
的元素里面绝对定位是你在找什么:在[css-tricks.com(http://css-tricks.com/absolute-positioning-inside-relative-positioning/)或[互联网](https://www.google.com/search?q=css+absolute+positioning+in+div) – Sherbrow 2013-05-11 23:34:55