我有一個圖像設置爲left: 50%;
。然而,它的右邊距離太遠,就像選擇器不在中間位置,而是在左邊。圖像不以50%爲中心
我的CSS代碼:
#scroll-down {
position: fixed;
width: 100%;
height: 64px;
margin-top: -64px;
}
#scroll-arrow {
position: absolute;
background: url("img/down-arrow.png") center no-repeat;
width: 64px;
height: 64px;
left: 50%;
}
我的HTML代碼:
<div id="scroll-down">
<div id="scroll-arrow"></div>
</div>
這裏的答案和解釋:http://stackoverflow.com/q/36817249/3597276 –