我无法使用css3&amp ;;获得渐变.jpg图像(在PhotoShop中创建)覆盖整个页面HTML5。我已经阅读并尝试了所有我无法找到的效果,或者“修复”完全删除了背景图像。这是代码,我尝试了很多不同的解决方案,包括w3schools.com,我可能错过了显而易见的(我希望):
@charset "UTF-8";
#main_container {
display: block;
clear: both;
overflow: hidden;
width: 960px;
height: 100%;
margin-right: auto;
margin-left: auto;
box-shadow: 0px 5px 10x 0px #362819;
background:#738A7A;
text-align: justify;
text-align: left;
border: 5px double #99AFA3;
}
body {
font-family:Tahoma,"Century Gothic","Lucida Grande";
font-size: 1.1em;
font-weight:bold;
line-height:1.5em;
padding:0px;
margin-bottom:15px;
background-color: #587056;
background-image: url('img/bkg.jpg');
background-size:cover;
}
#header {
text-align: center;
width: 960px;
}
#container {
line-height: 1.5em;
text-align:left;
color: #331100;
border: 4px ridge #587056;
padding: 8px;
margin: 8px;
width: 60%;
float: left;
}
感谢您的帮助。
答案 0 :(得分:0)
您需要将背景应用于html
元素,或将height:100%
添加到body
(但后一种情况只有在您margin:0
时才能正常运行那里)