我已将所有特色图片设置为我网站中每个页面的横幅。这是链接 - http://constantin-entertainment.info/fixitnow/about-us/ .我需要的是像我主页上的 slider 那样的背景颜色。这是主页的链接http://constantin-entertainment.info/fixitnow/ .我试过在图像前放置一个 div 并将一个类命名为 featured-img-bg 并设置没有帮助的背景颜色。我还尝试添加宽度也没有帮助。请任何人帮助我做这个。谢谢!! 这是我写的代码
<div id="content">
<div class="container clearfix">
<div class="featured-img-bg"><a href="http://constantin-entertainment.info/fixitnow/about-us/" title="Permalink to About Us"> <img width="1000" height="390" src="http://constantin-entertainment.info/fixitnow/wp-content/uploads/2014/04/slider.jpg" class="alignleft featured_image wp-post-image" alt="slider"></a></div></div>
我试过的css是
.featured-img-bg{background: none repeat scroll 0 0 #E4E4E4 !important;width:1349px;}
最佳答案
您必须在 div #header
关闭后粘贴以下代码。
<div class="featured-img-bg">
<a href="http://constantin-entertainment.info/fixitnow/about-us/" title="Permalink to About Us"> <img width="1000" height="390" src="http://constantin-entertainment.info/fixitnow/wp-content/uploads/2014/04/slider.jpg" class="" alt="slider"></a></div>
CSS 会像这样..
.featured-img-bg {
background: none repeat scroll 0 0 #E4E4E4 !important;
overflow: hidden;
text-align: center;
/*width: 1349px;*/ /*Not Required*/
}
.featured-img-bg img{float:none} /*Remove the by default added `float:left`*/
查看屏幕截图以获得更多权限。
关于html - 如何为页眉横幅添加背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23403389/