我现在花了几个小时尝试不同的事情来弄清楚如何在 css 中获取 2 个背景图像以扩展页面的整个宽度。
网站在这里:http://res-intel.com
我知道在#main 中定义宽度不会让它展开。但是我想不出解决办法。我认为 body 应该工作!我能做什么?
非常感谢!
相关的CSS代码是:
body {
background-image:url('http://res-intel.com/images/headerbg.jpg') repeat-x top right;
margin:auto;
padding:0;
text-align: center;
font-family:arial;
}
#main {
background: url('http://res-intel.com/images/contentbg.jpg');
background-repeat:repeat-x;
width:904px;
text-align:left;
}
最佳答案
你有语法错误。您不能为背景图像添加 repeat-x 和位置属性。您需要使用 like background 而不是 background-image。像下面这样更新您的 CSS。
body {
background:url('http://res-intel.com/images/headerbg.jpg') repeat-x top right;
margin:auto;
padding:0;
text-align: center;
font-family:arial;
}
关于html - x-repeating 背景图像未完全展开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24273856/