html - 如何为页眉横幅添加背景颜色

标签 html css styles stylesheet

我已将所有特色图片设置为我网站中每个页面的横幅。这是链接 - 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`*/

查看屏幕截图以获得更多权限。 enter image description here

关于html - 如何为页眉横幅添加背景颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23403389/

相关文章:

javascript - 循环仅附加到一个元素而不是多个元素

css - HTML5 - 如何为特定单元格指定固定宽度?

javascript - ExtJS4 启动画面 app.js 返回错误

css - SVG:我可以在样式的属性中放置 x 和 y 位置吗?

html - 未对齐的 CSS 溢出 UL 水平滚动条

html - 在 R Markdown 文件中包含 HTML 文件?

CSS 未在 IE 中显示(任何版本)

css - 无法更改标题内元素的行高

python - 使用 Pandas 风格我得到 KeyError : "None of . ...位于 [列]

javascript - 悬停时显示div