我的圖像響應大小,我試圖在它們的中心覆蓋播放圖標。我可以垂直居中但不水平放置圖標。中心跨度在圖像上的div容器內部
見我jsfidde
HTML:
<div class="img-container">
<img src="http://i.vimeocdn.com/video/503897818_640.jpg" style="width:315px;height:177px;">
<div class="post-video-overlay-lg">
<span class="glyphicon glyphicon-play" aria-hidden="true"></span>
</div>
</div>
CSS:
.post-video-overlay-lg {
position: absolute;
font-size: 72px;
color: #E5E5E5;
text-align: center;
width: 100%;
}
.img-container {
position: relative;
width:315px;
height:auto;
display:block;
margin:auto;
cursor:pointer;
}
任何想法,我缺少的是什麼?
你的意思是[this?](http://jsfiddle.net/jbutler483/f1becapq/2/) – jbutler483 2015-02-05 15:15:03
@ jbutler483這很接近,但如果我改變我的圖像的高度爲277px該圖標不再居中...... – Paul 2015-02-05 15:17:32
您是指圖片?或者圖形? – jbutler483 2015-02-05 15:21:28