Jump to content

[SOLVED] floating divs side by side without width


play_

Recommended Posts

Hi.

 

I have 2 divs: main content and sidebar, floating next to each other.

 

As usual, sidebar is to the right of the main content, however, not all pages have a sidebar.

 

At the moment, i have to give them both a certain width for them to say next to each other.

 

However, i am wondering if it's possible to only give the sidebar a width (say, 200px) and have the main content take up the rest of the space to the left.

 

This way, on pages that don't have the sidebar, the main content would stretch 100%.

 

is it possible?

 

 

question in a nutshell:

is it possible to have to divs next to each other, but only giving one of them a 'width' attribute?

Test that in IE - I think you will find that it's not working unfortunately.

 

Also unfortunately, I don't think you can solve this problem very easily. The best way I would suggest is to float the sidebar inside the content div, so that when it doesn't exist, the content inside the content div will fill out to the full width.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.