2014-09-06 26 views
0

我正在使用Underscores构建Wordpress主题。 在结构中我有一个宽度为275px的div。在这个div里面我有另一个div,里面有<img><h3>。当我尝试浮动图像以便h3环绕它时,浮动不会与主题一起工作,但它在单独的html文件中工作。这段代码有什么问题?浮动在下划线中的图像不起作用

.container{ 
      width: 275px; 
     } 
     .post-image-small { 
      float: left; 
     } 
     .post-image-small img { 
      display: block; 
     box-shadow: 0px 0px 1px 1px #777; 
     box-sizing: border-box; 
     border: 1px solid #fff; 
     float: left; 
     } 
     .post-image-small h3.post-title-small { 
     font-size: .85em; 
     margin: 0 !important; 
     } 
     .post-image-small h3.post-title-small a { 
     color: #444; 
     text-decoration: none; 
     } 
     .post-image-small h3.post-title-small a:hover { 
     color: orange; 
     } 
    <div class="container"> 
     <div class="post-image-small"> 
      <img src="http://localhost/viewport/wp-content/uploads/2014/09/iwatsh-150x150.jpg" width="50" height="50"> 
      <h3 class="post-title-small"><a href="http://localhost/viewport/?p=1490">Integer non nibh et nibh lacinia tempus</a></h3> 
     </div> 
    </div> 

预先感谢您

+0

你是什么意思,通过使用Underscores来建立一个Wordp雷斯主题? – ggdx 2014-09-06 21:53:58

+0

在开始WordPress的主题下划线,我用它来建立一个新的主题 – Adam 2014-09-06 21:56:10

+0

如果你在'.post-image-small img'的'float:left;'之后加上'!important',那会起作用吗? – Howli 2014-09-06 22:02:37

回答

0

在行158 style.css中的163 _s你有这样的:

h1, h2, h3, h4, h5, h6 { 
    clear: both;} 

所以你需要添加此之后的所有默认_S样式定义:

.container h3{clear:right} 
+0

谢谢。它的工作..我已经用它约2个小时。 – Adam 2014-09-06 22:22:29

相关问题