开发者

css layout - break down

So I am trying to get the effect of having two frames inside a 750px wide frame.

.news {width: 750px;}
.news1 {width:550px;}
.news2 {width:200px;}

Very simple css at this stage.

The html/php:

            <div class="news">
            <div class="format"><a href='newspiece.php?news=<?echo $id?>'><?echo "$subject\n";?></a></div>
                <div class="news1">
                    <?
                    echo "<div class='content'>";
                    echo nl2br($comment);
                    echo "<a href='newspiece.php?news=$id'>..[read more]..</a>\n";
                    echo "</div>";
                    ?>
                    <h5><? echo "Posted by <a href=\"userprofile.php?user=$posted\">$posted</a> on $final_date\n";?></h5>
                    &l开发者_Python百科t;? echo "<br />\n";?>
                </div>
                <div class="news2">
                    <img src="images/news/<? echo $id?>.jpg" />
                </div>
            </div>]

THe problem I am getting is that the image that should be on the right is going underneath. So in effect, news1 is above news2, rather than side by side. Any ideas?


Try using

.news1, .news2 {float: left}


You need to set the float property on the divs:

.news1 {width:550px; float: left;}
.news2 {width:200px; float: right;}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜