以下代码在FF3中呈现出色,但在IE7中不起作用。有谁知道如何解决它?
<div style="padding-top:3px;padding-bottom:5px;width:650px;background:blue">
<div style="height:50px;float:left;display:inline;width:500px;background:gray">http://www.brainsolis.com/2008/10/twitter-tools-for-comunity-and-love-for-...</div>
<div style="width:100%;text-align:right;float-right;background:yellow">saaal is saaa twittertool ds ds dsdfsdsdfsdfsdfsdfsdfsd sdf dsf sdf sdf sdf sd ssssssssssssssssssssssssssssssssssssssssssssssssssss</div>
</div>
最佳答案
您无需浮动元素,并同时显示:inline。此外,您无需为DIV元素设置width:100%。它们自然会占用所有可用的水平空间。
以下CSS应该可以实现您的尝试。
div.container {
}
div.floated {
width:50px;
float:left;
}
div.textbody {
/* styles */
}
br.clear {
clear:both;
height:0;
line-height:0;
}
<div class="container">
<div class="floated">
<p>This is floated</p>
</div>
<div class="textbody">
<p>...text body...</p>
</div>
<br class="clear" />
</div>
有关CSS的更多信息,请检查w3schools或观看。