我有一个元素,其位置属性为absolute。唯一的问题是我已经使用了一些属性将其水平居中对齐,并且在Mozilla上运行良好,但是相同的属性在Chrome上不起作用。
这是我的代码:
html
<a href="#section1" class="scrollTo downarrow"><img src="images/navbar_downarrow.png" class="img-responsive"/></a>
CSS
.slider{
position: relative;
background-image: url("../images/slider.jpg");
background-size: 100% 100%;
background-repeat: no-repeat;
}
.slider a.downarrow{
position: absolute;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
bottom: 20px;
display: table;
}
.slider
的宽度,例如width: 100vw;
。 - Banzay