【问题标题】:How to apply the same Background-image in different desktop devices如何在不同的桌面设备中应用相同的背景图像
【发布时间】:2012-09-08 17:53:57
【问题描述】:

如何在不同的桌面设备中为我的图像应用相同的背景图像位置?

这是有背景图片的页面:http://tommywebdesigner.com/Vision%20General.html

这是我的代码:

#vision {
background-attachment: fixed;
background-image: url("/img/lapedrera.jpeg");
background-position: 85% 62%;
box-shadow: 2px 1px 6px 0 #888888 inset;
height: 350px;
margin-top: 35px;
width: 100%;

}

如果您通过此工具查看http://quirktools.com 并粘贴 url,您会看到在不同的桌面设备中,背景图像会改变位置,我怎样才能使我的图像与不同的背景图像具有相同的位置桌面设备?

希望解释清楚

【问题讨论】:

    标签: css background position background-image background-position


    【解决方案1】:

    我不确定我是否正确理解了您的问题。如果您希望图像无论向下滚动多少都显示相同的区域,则必须删除此属性:

    背景附件:固定;

    【讨论】:

    • 可以设置为:background-position: center 1115px;然后你可以保持 background-attachment: fixed;
    • 好的,很酷,它似乎工作正常,你能解释一下这是什么意思吗?非常感谢
    • 您将背景位置设置为百分比值。这衡量了访问浏览器的大小。 center 值告诉图像在 div 元素内居中显示。 1115px 告诉 y 轴上从哪里开始显示图像。通过这种方式,您可以使其在不同的屏幕分辨率下看起来相同。
    猜你喜欢
    • 1970-01-01
    • 2021-04-25
    • 1970-01-01
    • 2014-12-07
    • 1970-01-01
    • 1970-01-01
    • 2017-11-12
    • 1970-01-01
    • 2018-12-04
    相关资源
    最近更新 更多