我的背景圖像應該只填充body元素,但它佔用了整個視口。我編輯了我的原始帖子以擺脫無關的代碼。我希望我在這裏發佈的內容足夠,但不是太多。基本上,發生的事情是HTML的背景顏色填滿了屏幕,並且沒有顯示身體中的背景圖像。任何幫助,將不勝感激。填充全屏不只是身體的背景圖像
html {background: #95A3C2;}
body {
background-image: url(_images/pg_p_lewis_bckgrnd.jpg);
width: 960px;
margin: 0 auto 0;
font-size: 1.1em;
line-height: 1.3em;
font-family: "minion-pro";
}
<body>
<div id="main">
<div class="text">
<p>text</p>
</div>
<div class="image">
<p>Image Gallery</p>
<p><span class="caption">Center image vertically on page and hover to enlarge.</span></p>
<p><img class="img-zoom" src="_images/RL_LEWIS_Alex_KCC_1197_Sur_1.jpg" class="img-thumbnail" alt="lewis land grant" width="259" height="387"></p>
</div>
</div>
<script src="jquery.js"></script>
<script>
$(document).ready(function(){
$('.img-zoom').hover(function() {
$(this).addClass('transition');
}, function() {
$(this).removeClass('transition');
});
});
</script>
</body>
</html>
你有太多的代碼,難以置信地告訴你正在嘗試做什麼。理想情況下,你的問題應該比代碼更多的非代碼。請參見[如何創建最小,完整和可驗證的示例](http://stackoverflow.com/help/mcve) – Gerrit0
background-size?爲什麼你沒有在你的身體中輸入背景大小? – Obink
我嘗試添加一個背景大小,但我有同樣的問題 - HTML顏色顯示整個屏幕和背景圖像不顯示在正文中。 –