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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.