css - 防止 float 图像在ie6中清除<p>

标签 css internet-explorer-6 css-float

我正在做一个所见即所得的网页编辑器:http://brokenmyriad.com/editor2.php ,但是我在尝试添加图像功能时遇到了问题。

注意:该图像在 contenteditable 元素内,而只是普通的 float 图像。

可以通过单击段落或标题并单击工具栏上的插入图像按钮(最右边的按钮)来重现该问题。 (在上面的链接页面上)。

在基于标准的浏览器中,它按预期工作,标题和段落都位于图像的右侧,但是在 ie6 中,段落位于 float 图像下方,如下图所示:http://tinypic.com/view.php?pic=2mfcfo8&s=3

我的简化代码结构如下:

<div>
  <img style='float:left'>
  <h1>Click here to edit!</h1> 
</div>
<div>
  <p>Click here to edit!</p> 
</div>

我想要的是 <p>元素位于 float 图像旁边,并位于 <h1> 下方元素,因为它在基于标准的浏览器中。

如有任何帮助,我们将不胜感激!

最佳答案

为什么段落在单独的 div 中?以下是否可行:

<div>
    <img style='float:left'>
    <h1>Click here to edit!</h1> 
    <p>Click here to edit!</p> 
</div>

如果你必须有div,那么第二个需要嵌套

<div style="float: left;">
    <img style='float:left'>
    <h1>Click here to edit!</h1> 
    <div style="float: left;">
        <p>Click here to edit!</p> 
    </div>
</div>

关于css - 防止 float 图像在ie6中清除<p>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3276345/

相关文章:

php - UL 列表样式不适用于 woocommerce 结帐页面

css - 嵌套的 div 定位与 css

html - float 无序列表 - 适用于 jfiddle 而不是浏览器(尝试更新 chrome 和 firefox)

html - 在 float 元素下方显示 block 元素

javascript - IE6兼容性。页面在任何地方都可以正常工作,但在 IE6 中

php - 管理面板读取的子文件夹 CSS 模板 header

html - 如何用纯 CSS 绘制旋转器?

css - 页面布局中的自动div高度调整

css - 将 input[type ="text"] 与其他选择器一起使用

html - 关于 HTML 条件注释