简体   繁体   English

将左框文字环绕右浮动,保留标记语义,IE> = 8

[英]Wrap left box text around right float, keep markup semantic, IE>=8

What we want: 我们想要什么:

div a text div a text  | div b text |
div a text div a text  | div b text |
div a text div a text  | div b text |
div a text div a text div a text diva
div a text div a text div a text diva
div a text div a text div a text diva

What we have: 我们有什么:

<div id="a">
    <h3>...</h3>
    <p>...</p>
    <p>...</p>
</div>

<div id="b">
    <h3>...</h3>
    <p>...</p>
</div>

If the order of the content in the two div's must remain in the order given (note that content is variable), how is it possible to achieve what we want (and work in IE8...)? 如果两个div中内容的顺序必须保持给定顺序 (请注意内容是可变的),那么如何实现我们想要的(并在IE8中工作...)?

Div b is of a fixed width, variable height, and the container div of div a and div b is of a fixed width. Div b的宽度是固定的,并且高度是可变的,并且div adiv b的容器div是固定的宽度。

EDIT 1 编辑1

I've discovered the technique of inserting a dummy div above div a , setting it's width to that of div b , using JS to calculate height of div b and applying that to the dummy div, floating the dummy div right, then absolutely positioning div b on top of the dummy div. 我发现了一种在div a上方插入虚拟div,将其宽度设置为div b的宽度,使用JS计算div b高度并将其应用到虚拟div,将虚拟div右移然后绝对定位div b在虚拟div顶部。 It's the only way I've found that maintains the order of the content in div a and div b without using advanced CSS3... 这是我发现不使用高级CSS3就能保持div adiv b内容顺序的唯一方法...

将以下示例调整为所需的宽度: http : //cdpn.io/heDJu

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM