Reputation: 13855
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
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
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