IAmGroot
IAmGroot

Reputation: 13855

Trying stop the body from being placed below the sidebar

http://jsfiddle.net/5V7Q7/3/

What I am trying to do is stop the body from moving below the sidebar when there is not enough space for the body next to the sidebar.

I would much prefer that the body becomes hidden off screen. than be placed Below the sidebar.

(Resize the browser to see effects) - Click fiddle link for example of what is happening.

Upvotes: 1

Views: 115

Answers (2)

Ahmad Alfy
Ahmad Alfy

Reputation: 13371

Please note that display:table-cell is not recognized by IE7. You will have to write a separate style sheet for IE7

I've created a different approach, the width is no more of the sidebar ... both are based on percentage. Check this out. If IE7 doesn't bother you then used the solution mentioned above.

Upvotes: 0

Boycott Russia
Boycott Russia

Reputation: 12107

Here's the jsfiddle to do what you want

Basic idea is:

#body, #sidebar {display: table-cell;}

and remove all float:left.

Upvotes: 1

Related Questions