如何使全屏背景图像大于窗口视图

How make a full screen background image larger than the window view?

本文关键字:大于 窗口 视图 图像 背景 何使全      更新时间:2023-09-26

我有一个网页的全屏背景使用这个代码

html, body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
}
#background-image{
  z-index: -999;
  min-height: 100%;
  min-width: 1024px;
  width: 100%;
  height: auto;
  position: fixed;
  top: 0;
  left: 0;
  }

这是好的,但我想做的是隐藏图像的4个边框,并使图像在背景中居中。

看看这张图片,看看我到底需要什么https://dl.dropbox.com/u/7064770/untitled - 1. - png

任何javascript代码也被广泛接受

尝试使用CSS3 background-size属性:

#background-image{
  background-size:cover;
  z-index: -999;
  min-height: 100%;
  min-width: 1024px;
  width: 100%;
  height: auto;
  position: fixed;
  top: 0;
  left: 0;
  }