我希望背景只对屏幕尺寸变化做出水平响应,我不希望其周围出现灰色框。

div的CSS:

.col-xs-8.arrow-red {
    background-image: url(../img/arrow-red.png);
    background-repeat: no-repeat;
    background-size: 100%;
    background-position: center center;
    height: 135px;
}


在桌面上:

在iPad上:

最佳答案

您可以为背景设置固定高度。
像这样使用-

-o-background-size:100% 50px;
-webkit-background-size:100% 50px;
-moz-background-size:100% 50px;
background-size:100% 50px;


link

关于css - 如何使背景仅在不同的屏幕尺寸上水平调整?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27587118/

10-17 00:14