play_ Posted July 20, 2009 Share Posted July 20, 2009 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? Quote Link to comment Share on other sites More sharing options...
play_ Posted July 20, 2009 Author Share Posted July 20, 2009 Ok solved. Giving both divs a table cell display did it. Quote Link to comment Share on other sites More sharing options...
haku Posted July 21, 2009 Share Posted July 21, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.