2

我对文本及其围绕浮动元素的包装有疑问。

在 IE 中它是正确的以及我想要它的方式,而在 FF 中它表现得很奇怪......在 FF 中,文本换行太快,并且周围div没有像您期望的那样扩展。

我搜索了高低并测试了自己的蓝色,但没有结果。有人知道我该如何解决这个问题,所以它在 FF 中的行为也应该如此吗?我知道我可以通过设置宽度来解决它,但我想要一个动态布局(如果可能的话......)!下面的代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>

<body>

  <table style="border:2px solid steelblue;overflow:hidden;">
    <tr>
      <td style="width:100%;">
        <div id="page_content" style="float:left;background-color:#ffffff;">
          <div style="float:right;border:1px solid red;">
            ROTA FLOATED RIGHT
          </div>
          <p style="margin:0;border:1px solid green;">
            This is just a stupid text to show my point...
          </p>
        </div>
      </td>
    </tr>
  </table>

</body>

</html>

4

2 回答 2

0

Try this one

Just put the 'float:left' in your 'p' tag like this.

<p style="margin: 0px; border: 1px solid green; float: left;"> This is just a stupid text to show my point... </p>

Implement this one one and get the result as same in all the browsers

于 2012-09-26T15:06:13.090 回答
-3

尝试这个:

<table style="border:2px solid steelblue;overflow:hidden;">
        <tr>
            <td id="page_content" style="background-color:#ffffff;border:1px solid green;">
                        This is just a stupid text to show my point...
            </td>
            <td style="border:1px solid red;">
                ROTA FLOATED RIGHT
            </td>
        </tr>
    </table>​
于 2012-09-26T10:35:20.373 回答