【问题标题】:How can I get the backround of my div in a fixed position?如何让我的 div 的背景处于固定位置?
【发布时间】:2012-12-25 08:39:42
【问题描述】:

我正在为我的新网站编写代码,因为您可以向下滚动此 div,所以我需要修复背景:

    <div id="main" style="background-image:url('bg5.png'); background-repeat: repeat; background-        size: 924px; width:924px; height: 526px;  float: right; z-index:-1; overflow-y:scroll;">
    </div>

我需要尽快得到答案,请帮忙!谢谢

【问题讨论】:

    标签: image html positioning background-image


    【解决方案1】:

    要将背景图片设置在固定位置,可以使用以下 CSS:

    background-attachment:fixed;
    

    您可以在http://www.w3schools.com/cssref/pr_background-attachment.asp 找到有关background-attachment 属性的更多信息

    【讨论】:

      猜你喜欢
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-07
      • 1970-01-01
      相关资源
      最近更新 更多