开发者

How to float 2 div's next to each other in IE8

开发者 https://www.devze.com 2023-03-14 11:45 出处:网络
I have two div\'s and I want to show them next to each other. In normal browsers it\'s no problem. In IE however, things are messed up:

I have two div's and I want to show them next to each other. In normal browsers it's no problem. In IE however, things are messed up:

How to float 2 div's next to each other in IE8

The red squares point out the div's I'm talking about. The left div has the class "head_narrow", the image has the id "branche_header_image". My CSS looks like this:

.head_narrow {width:380px; float:left;}
#branche_header_image {float:right;}

I am sure that the width of the two divs together is smaller than the width of t开发者_JAVA百科he wrapper. What's going on?


Add "width" in this id #branche_header_image {width:400px; float:right;}

Or use

display:inline;

for both divs instead of using float.


You could probably solve it more elegantly by displaying them as inline blocks inside a container div. But if you absolutely must use floats, place divs above and below your two floaters with style="clear: both;".

0

精彩评论

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