【问题标题】:How to add background color to Header Banner如何为标题横幅添加背景颜色
【发布时间】:2014-06-17 16:14:52
【问题描述】:

我已将所有特色图片设置为我网站中每个页面的横幅。这是链接 - http://constantin-entertainment.info/fixitnow/about-us/ 。我需要有一个背景颜色,就像我在我的主页中拥有的那样滑块。这里是主页http://constantin-entertainment.info/fixitnow/ 的链接。我尝试在图像之前放置一个 div 并将一个类命名为 features-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;}

【问题讨论】:

  • 把相关代码贴在这里会更好。 jsbin.com
  • 我已经发布了代码
  • 请访问 jsbin.com 创建一个 bin(正如 @KheemaPandey 已经提到的那样)并在此处分享链接,以便我们轻松为您提供帮助。
  • jsbin.com/vimur/1这是我创建的bin,你可以查看
  • 我已经发布了我的答案,请在下方查看。

标签: html css styles stylesheet


【解决方案1】:

您必须在 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`*/

查看屏幕截图以获得更多许可。

【讨论】:

  • 我在用wordpres的class align left是自动生成的,所以不知道在哪里编辑
  • 你可以在这里使用 CSS 特殊性。在你的 css 文件中添加这个 CSS。 .featured-img-bg img{float:none;}
猜你喜欢
  • 2017-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-25
  • 2019-02-28
  • 1970-01-01
相关资源
最近更新 更多