【发布时间】:2014-06-14 17:24:57
【问题描述】:
我是我网站背景的整页滑块,它在台式机上效果很好。但是,当我切换到移动设备时,图片严重失真,并且页面左侧有一个黑色间隙,看起来一点都不好看。
查看所附照片以获得视觉效果或将其拉到手机上, 网址是http://plunderfest.muvltd.com
有什么办法可以用一些 CSS 解决这个问题?
(根据要求编辑)CSS:
#supersized {
display: block;
position: fixed !important;
background-size: cover !important;
left: 0;
top: 0;
overflow: hidden;
z-index: -999;
height: 100%;
width: 100%;
}
正文背景图片css:
body {
background-image: url(http://plunderfest.muvltd.com/wp-content/uploads/2014/04/starry4.jpg) !important;
background-repeat: no-repeat !important;
background-attachment: fixed !important;
background-size: 100% !important;
width: 100% !important;
height: 100% !important;
}
仅 CSS 最大宽度为 767 像素:
@media (max-width: 767px) {
.hidden-desktop {
display: inherit !important;
}
.visible-desktop {
display: none !important;
}
.visible-phone {
display: inherit !important;
}
.hidden-phone {
display: none !important;
}
.woocommerce ul.products li.product.one_fourth,
.woocommerce-page ul.products li.product.one_fourth,
.woocommerce ul.products li.product.one_third,
.woocommerce-page ul.products li.product.one_third,
.woocommerce ul.products li.product.one_half,
.woocommerce-page ul.products li.product.one_half,
.woocommerce .cart-collaterals .cross-sells ul.products li.one_fourth,
.woocommerce-page .cart-collaterals .cross-sells ul.products li.one_fourth,
.woocommerce .cart-collaterals .cross-sells ul.products li.one_third,
.woocommerce-page .cart-collaterals .cross-sells ul.products li.one_third,
.woocommerce .cart-collaterals .cross-sells ul.products li.one_half,
.woocommerce-page .cart-collaterals .cross-sells ul.products li.one_half,
.one_sixth,
.one_fifth,
.one_fourth,
.one_third,
.one_half,
.two_third,
.three_fourth {
display: inline;
float: left;
margin-right: 0;
overflow: hidden;
position: relative;
width: 100%;
}
.fimage-align-right,
.fimage-align-left {
float: none;
text-align: center;
margin-left: 0;
margin-right: 0;
}
}
【问题讨论】:
-
您使用的是什么滑块,您可以发布 css 吗?
-
我正在为一个名为最后通牒的主题使用滑块,我手头也有革命滑块,但设置为整页本身就很痛苦。我会将 css 添加到我的原始帖子中。
-
如果您只使用一页,则无需使用滑块作为背景。浏览滑块代码来编辑调整大小时无法正确响应的原因是浪费时间。只需按照我在答案中发布的操作,它应该可以正常工作。
-
如下所述,我知道如何设置页面的背景。我不知道如何将其固定到设定位置
-
好的,所以现在背景只覆盖了手机屏幕的一半,并且没有固定(在桌面上工作正常)。我对其进行了更新,以向您展示身体背景图像的当前 css。
标签: html css wordpress responsive-design