调整窗口大小(CSS)时修复背景图像

时间:2014-03-22 00:56:57

标签: css responsive-design background-image

我一直坚持这个问题几个小时:

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

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'和'fixed',但这显然不起作用。

1 个答案:

答案 0 :(得分:0)

尝试

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

实际上,根据需要调整z-index

相关问题