【问题标题】:Making background-image fixed when resizing window (CSS)调整窗口大小时固定背景图像(CSS)
【发布时间】:2014-04-29 14:30:17
【问题描述】:

我已经被这个问题困扰了好几个小时了:

当窗口大小调整到 820 像素以下时,我正在尝试固定图像的位置。 我需要这个,因为图像会与标题中的重要文本重叠(相同颜色)。

CSS:

#banner {
  background:url(path/to/image) no-repeat 100%;}

@media screen and (max-width: 819px) {
  #banner {
  background:url(path/to/image) no-repeat x y z;}
}

我尝试过使用“820px”和“固定”,但这显然不起作用。

【问题讨论】:

    标签: css responsive-design background-image


    【解决方案1】:

    试试

    @media screen and (max-width: 819px) {
      #banner {
         background:url(path/to/image) no-repeat x y z;}
         z-index:-10;
      }
    

    其实根据需要调整z-index

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-26
      • 1970-01-01
      • 2021-10-02
      • 2019-06-17
      • 2023-02-11
      • 1970-01-01
      相关资源
      最近更新 更多