/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Float acts differently in IE and Fx

Hi!

I would be happy if someone could help me figure out the following:

I have container divs with a width and a margin-bottom.

Inside the container divs I have three divs with width and float:left.

What I want is the result that I get in Internet Explorer, but in Firefox (plus Opera and Safari) it looks completely different. The only way I’ve figured out to fix it in Firefox is to set a height to the container div, but I don’t want to do that as I want the content in the three divs inside the container to decide the height.

The (simiplified) code looks like this:

The css:

[CODE]
.container
{width:300px; margin-bottom:20px}

.left
{width:100px; float:left; background-color:#cccccc}

.middle
{width:100px; float:left; background-color:#999999}

.right
{width:100px; float:left; background-color:#666666}
[/CODE]

The html:

[CODE]
<div class=”container”>
<div class=”left”>aaa<br>aaa</div>
<div class=”middle”>bbb</div>
<div class=”right”>ccc</div>
</div>

<div class=”container”>
<div class=”left”>ddd</div>
<div class=”middle”>eee</div>
<div class=”right”>fff</div>
</div>
[/CODE]

I’ve attached images where you can see the outcome in the two browsers
Grateful for help!

/Theresa

[upl-file uuid=b182d042-b251-4e36-9c22-0e36fe13f545 size=979B]ie.gif[/upl-file]

[upl-file uuid=bff98c36-ec0f-43e0-8fbb-36ffd39d4b27 size=1kB]fx.gif[/upl-file]

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyJul 10.2007 — &lt;div class="container"&gt;
&lt;div class="left"&gt;ddd&lt;/div&gt;
&lt;div class="middle"&gt;eee&lt;/div&gt;
&lt;div class="right"&gt;fff&lt;/div&gt;
[B] &lt;div style="clear: both;"&gt;&amp;nbsp;&lt;/div&gt;
[/B]&lt;/div&gt;
Copy linkTweet thisAlerts:
@LindaTheresaauthorJul 10.2007 — Thanks a lot!

Works perfectly!

/Theresa
×

Success!

Help @LindaTheresa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...