javascript - 使用背景附件 :fixed 时图像在 chrome 中移动

标签 javascript html css

当我使用 chrome 时,我的背景图像在带有 background-attachment:fixed 的 chrome 中移动......但它在 firefox 上工作正常。请帮助我......

in chrome

in firefox

在此输入验证码

.bkimg1
{
    background-image: url('justice-league1.jpg');
    background-attachment: fixed;
    height: 100%;
    margin:0px;
    padding:0px;
    background-position:top;
    background-size: cover;
    position: relative;
    opacity: 0.8;
    background-repeat: no-repeat;   
    max-width:1100px;
}
<div class="bkimg1">
            <div class="text">
                <div class="border">
                    WELCOME EVERYONE
                </div>
                <input type="button" value="Get Started" onclick="init(),scrolldownpage('profiles')"/>
            </div>
        </div>

谢谢

最佳答案

尝试更改 background-position 属性。:

backgroun-position: center;

请查看此链接以获取更多详细信息。 https://www.w3schools.com/cssref/pr_background-position.asp

关于javascript - 使用背景附件 :fixed 时图像在 chrome 中移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50934575/

相关文章:

javascript - 为什么 $scope.someArray.push 不是传递给 $q.promise 上的 .then 的有效函数

javascript - 从 &lt;script&gt; 链接获取查询字符串的安全风险?

javascript - 如何使用 Javascript 或 jQuery 将输入类型复选框存储到 json 对象中?

javascript - 如何使用 Angularjs 在点击事件上填充 HTML div

html - vertical-align :super raise the baseline 多少

css - Input type=date 右边的旋转控制按钮没有垂直对齐

javascript - 网站不加载布局

javascript - D3 v4 - 尝试将我的数据文件 '2017-09-19T00:00:00' 中这样格式化的日期转换为更易读的 'Sep 19, 2017'

javascript - 将集合而不是数组传递给 fetch().then() 回调

javascript - jQuery:自动完成,单击按钮时不关闭