0

以下代码在 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>
4

3 回答 3

3

您不需要浮动元素,同时display: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在 SampsonVideos 观看 CSS 视频

于 2009-01-19T19:56:06.443 回答
2

我没有检查你的样本,但这为我解决了 IE 包装问题:

div
{
  word-wrap: break-word;  /* for IE, force it to wrap text and keep it inside the div */
}
于 2009-02-13T21:12:06.493 回答
1

css word-wrap 指令对我有用

在 ie6、7、8 和 chrome 中尝试过(像往常一样,即使没有它,Firefox 也会正确包装我的文本)

似乎是 IE 发明,但也兼容 css3 ( http://www.css3.com/css-word-wrap/ )

于 2010-01-08T03:12:20.230 回答