DIV浮动和尺寸问题

时间:2011-04-26 03:03:49

标签: css html sizing

我有div大小和浮动问题。当我有小文字时,没关系:
SEE IMAGE
但看看当我有大文字时会发生什么 SEE IMAGE

HTML:

<div class="news">
    <div class="img">
        <img src="url">
    </div>
    <div class="wrap">
        <div class="title">TITLE</div>
        <div class="text">TEXT</div>
    </div>
</div>

CSS:

.news{
    float:left;
    padding:5px 5px 2px 5px;
    margin-bottom:10px;
}
.news > .img{
    float:left;
    width:75px;
    margin-right:5px;
}
.news > .img > img{
    height:75px;
    width:75px;
}
.news > .wrap{
    float:left;
}
.news > .wrap > .title{
    font-size:14px;
}
.news > .wrap > .text{
    text-align:justify;
}

请帮助..

4 个答案:

答案 0 :(得分:0)

本教程应该会有所帮助:

http://www.monkeydoit.com/wrap-text-images-css.php

答案 1 :(得分:0)

您必须将宽度设置为.wrap容器。

答案 2 :(得分:0)

尝试:

.news {
    float:left;
    padding:5px 5px 2px 5px;
    margin-bottom:10px
}
.news .img {
    float:left;
    width:75px;
    margin-right:5px;
}
.news .wrap .title { font-size:14px; }
.news .wrap .text { text-align:justify; }

答案 3 :(得分:0)

给出正确的宽度换行div

在新闻div上给出100%的宽度