开发者

div css layout looks different depending on previous div

开发者 https://www.devze.com 2023-02-13 10:07 出处:网络
The following code renders different layout if I remove the \"menu\" div code: the left text box shows more to the left in Firefox 3.6.13 and IE 8.0.

The following code renders different layout if I remove the "menu" div code: the left text box shows more to the left in Firefox 3.6.13 and IE 8.0.

<div id="whole开发者_Go百科" style="width:800px;">
    <div id="menu" style="display:inline; width:800px;">
        <select name="select" id="c" style="display:inline; float: left; width:200px;" >
            <option value="alpha" selected="selected">alpha</option>
            <option value="omega">omega</option>
        </select>
    </div>
    <br>
    <div id="twoTextBox" style="display:inline; width:800px;">
        <div id="frame1" style="display:inline; float: left; width:250px;">
            <textarea rows="8" cols="20"  style="display:inline; float: left; width: 250px;"></textarea>
        </div>

        <div id="frame2" style="display:inline; float: right; width:250px;">
            <textarea rows="8" cols="20"  style="display:inline; float: right;  width: 250px;"></textarea>
        </div>
    </div>
</div>

Why is the "menu" div css interfering with the following div css?


remove the float:left; from the select and will be the same in all browsers. Also add overflow:auto for #whole to clear the floats, and try to avoid the inline styles.

Demo: http://jsfiddle.net/vFaRR/2/


You have 3 divs, 2 float left, 1 floats right. When you remove the far left div, the middle one floats left to take up the vacant spot.

If that's what you mean, it's working correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消