【问题标题】:Work-around for IE7 to wrap text when hasLayout appliedIE7 在应用 hasLayout 时换行文本的解决方法
【发布时间】:2014-04-07 19:15:01
【问题描述】:

对于已知的 IE7 问题,当文本的容器应用 hasLayout 时,文本不会环绕浮动元素(在这种情况下,由于高度,这是必需的),是否有解决方法?

例如:

<div style="width:200px;">
    <div style="float:right; width:50px; height:100px; background:#ff0;">&nbsp;</div>
    <div style="background:#0ff; height:400px;">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
    tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
    consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
    cillum dolore eu fugiat nulla pariatur. 
    </div>
</div>

【问题讨论】:

    标签: html css haslayout


    【解决方案1】:

    使用以下流程:

    • 为每一行创建一个占位符元素
    • 为每个占位符设置float:left; clear:left; overflow:hidden; 和通用高度
    • 为每个占位符设置特定宽度

    这是一个例子:

    #holdit em {display:block; float:left; height:18px; overflow:hidden; clear:left;}
    .a230 {width:230px;}
    .a240 {width:240px;}
    .a250 {width:250px;}
    .a270 {width:270px;}
    .a300 {width:300px;}
    .a340 {width:340px;}
    .a360 {width:360px;}
    .a370 {width:370px;}
    .a400 {width:400px;}
    .a420 {width:420px;}
    .a430 {width:430px;}
    .a460 {width:460px;}
    .a490 {width:490px;}
    .a500 {width:500px;}
    .a540 {width:540px;}
    .a550 {width:550px;}
    

    参考文献

    【讨论】:

      猜你喜欢
      • 2011-07-03
      • 1970-01-01
      • 2011-10-27
      • 1970-01-01
      • 1970-01-01
      • 2012-05-26
      • 2011-11-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多