H
H
Hint2012-03-24 11:56:19
css
Hint, 2012-03-24 11:56:19

Two columns: rubber and fixed. Float and Clear in the first one?

There is a simple two-column layout (fluid site with a fixed menu) and a glued footer. The menu width is in px (percentages are not appropriate). The menu can be above the content.
How can I make float and clear inside the rubber block not affect the layout? Now everything after clear is moved down by the height of the menu.
The fact is that the site is old and contains hundreds of made-up pages (often "clear: both" is used). A new design is coming up. The task is not to break what is.
Example:
jsfiddle.net/yRcg7/HTML
:

<div class="sidebar">Menu</div>
<div class="content">
    before
    <div>
        <div class="float" style="background: black;"></div>
        <div class="float" style="background: white;"></div>
        <div class="clear"></div>
    </div>
    after
</div>

CSS:
.sidebar {width: 100px; float: right; background: red; height: 200px;}
.content {margin-right: 150px; background: silver; height: 500px;}
.float {float: left; width: 20px; height: 20px;}
.clear {clear: both;}

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stdit, 2012-03-24
@Stdit

It's obvious: don't use float for other purposes (floating and text wrapping): jsfiddle.net/yRcg7/1/

H
HeavenlyDrug, 2012-03-24
@HeavenlyDrug

clear clear, parent overflow:auto or hidden

D
Danila Buyanov, 2012-03-24
@DanyBoo

so .content{overflow: hidden} solves everything, but you can’t look at the site, it would be more convenient

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question