0

我正在努力搜索,但仍然没有找到smth。

这是代码:

          <div class="SingleNewsMain" news-type = "{$value.news_type_id}" >

                    <div class="NewsTitleMain">
                        <a href= "index.php?show_news={$value.id}"><!--{$value.title}-->Some random header</a>
                    </div>
                    <div class="NewsMainImage">
                        <a href="#">
                            <img src="img/13095.png">
                        </a>    
                    </div>  

                    <div class="NewsMainShort"> 
                        <!--{$value.short_text}-->
                        Some random description
                    </div>

                    <div class="NewsInfo">
                            <span>
                            <icon class="icon-eye-open"></i>
                            </span>
                            <span class="ViewsInfo">2100</span>                         

                            <span>
                            <icon class="icon-comment"></i>
                            </span>
                            <span class="CommentaryInfo"> 46</span>
                    </div>
                </div>

这是我的 CSS

.SingleNewsMain{
  border-bottom: 1px solid rgb(175,175,175);
}
.NewsTitle {
  font-size: 24px;
  padding-top: 20px;
  line-height: 27px;
  font-family: 'Playfair Display SC';
}

.NewsTitleMain {
  font-size: 24px;
  padding-top: 20px;
  line-height: 25px;
  font-family: 'Playfair Display SC';
}

.NewsMainImage{
  padding: 10px 10px 5px 0px;
  width: 200px;
  height: 110px;
  float: left;
  clear: both;
}
.NewsMainShort {
  font-size: 14px;
  padding-top: 5px;
  padding-bottom: 30px;
  position: relative;
}

还有两张截图,第一张。.NewsMainShort有财产clear:both

http://imageshack.us/photo/my-images/833/x7cp.png/

第二.NewsMainShort没有属性clear:both

http://imageshack.us/photo/my-images/96/jl29.png/

我希望文本简单地环绕图像,而不像第二个屏幕截图那样。Chrome 中的检查元素显示,当没有图像的 DIV 时,它的高度clear:both不适合。SingleNewsMain

4

1 回答 1

1

尝试像第二个屏幕截图中一样保留 css,但在之后添加:

<div class="NewsMainShort"> 
                    <!--{$value.short_text}-->
                    Some random description
                </div>

<br style="clear:both;">
于 2013-10-29T22:14:54.090 回答