By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

div background with 2 floats not visible

P: n/a
ar
Oke,

Problem is:
background of the preceding div is not shown if 2 floats are active. If
1 float is active the background is seen.
IE and Firefox behave both the same, so it is my fault. But what is
wrong with this code?

Ar

html file is:
....
<div class="midden">
<div class="indexkolom1">
</div>
<div class="indexkolom2">
</div>
</div>

Css file is:
body{font: 0.7em/1.5em verdana,arial,helvetica,sans-serif;color:black;
margin-bottom:2em}

..midden{margin:1px 90px 0px 200px;background:url(achtergrond.jpg)
no-repeat #fdedee center}
..indexkolom2{float:right;width:48.5%}
..indexkolom1{float:left;width:48.5%}

Jan 15 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

At first, to better understand what happens you can add

div { border:1px black solid; }

No you can see at least some thing :-) The problem is that all your
divs has zero height. Write

<div class="indexkolom1">1</div>
<div class="indexkolom2">2</div>

Floating boxes expanded, but not the "midden". Now add new rules to
the .midden class:

overflow: auto;
width: 100%;

Refer to the http://www.quirksmode.org/css/clearing.html for more info.
- Alex.

Jan 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.