2012-06-18 46 views
0

我有一個容器div(outer_most_container),我想放置一個圖像(藍色漸變)作爲背景。滾動時圖像應該固定。現在的問題是,圖像的寬度爲1040像素,應該適合65em的div的寬度,但不是。圖像不適合內部Div

此外,我不確定爲什麼縮小圖像時會消失。

http://i.imgur.com/patgb.png

HTML

<!DOCTYPE HTML> 
<html> 
<head> 
    <title>UnderWater Theme</title> 
    <link rel="stylesheet" href="underwater.css" /> 
</head> 
<body> 
    <div class="outer_most_container"> 
      <div class="top"> 
       <div class="banner">  
       </div> 
      </div> 
    </div> 
</body> 
</html> 

CSS

* { 
    margin: 0; 
    padding: 0; 
} 
html { 
    font-size: 100%; 
    height: 100%; 
} 
body { 
    font-size: 1em; 
    background-color: black; 
    height: 100%;  
} 
.outer_most_container { 
    position: relative; 
    width: 65em; 
    height: 43.75em; 
    margin: auto; 
    background-image: url('Aura.jpg'); 
    background-attachment: fixed; 
    background-repeat: no-repeat; 
    background-color: red; 
} 
+0

我建議使用HTTP:/ /html5boilerplate.com/它有一個很好的CSS重置,而不是你在這裏使用的一般選擇器CSS重置。 –

回答

0

我能夠防止調整通過縮小在圖像:

background-size: 65em 43.75em;