Legend doesn't float left on IE7

∥☆過路亽.° 提交于 2019-12-13 04:41:50

问题


I am having trouble on IE7. I have following html format.

<fieldset class="wrapper">
    <legend class="ct">Legend </legend>
    <div class="ct">Div 1</div>
    <div class="ct">Div 2</div>
</fieldset>

And this is the css style

.wrapper .ct {
    display:inline-block;
    *display:inline; /*IE7*/
    float:left
}

when I test this on other browser it works fine but IE7 does not. Please see screenshot below. But if I use div instead legend then it works. Here is on Jsfiddle


回答1:


Andres almost had it. Add a "*float: none" after the "float: left" and you should be good.

.wrapper .ct {
    display:inline-block;
    float:left;
    *display:inline;
    *float:none;
}​

Here's the updated fiddle




回答2:


IE does not understand display:inline-block, you can use display:inline instead with a hack to target that browser alone, like so:

.wrapper .ct {
    display:inline-block;
    *display:inline;
    float:left
}



回答3:


For IE7 only, try setting to display: inline (not inline-block).

Right, forgot how much a pain legend is. You likely need to use absolute position to place it as such - with a left margin on the others or padding-left on the parent. Depends on the design.



来源:https://stackoverflow.com/questions/10020972/legend-doesnt-float-left-on-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!