I would like to have a container (with some text) to the left of the page, which adapts itself with the available space, and 2 sidebars to the right (I use Wordpress). (2 sidebars work fine with float
.) So I tried width:auto
in the container.
But it does not adapt to the rest of the available space (it takes up the entire width of the page). If I set the width to 70%, it corresponds to the space on the index page, but if I click on the article, I will only have 1 sidebar, so there will be an empty space between the text and the sidebar.
Do you know how to fix this?
#container { overflow:auto; width:auto; position:relative; float:left; } #primary { position:relative; border:1px solid red; float:right; width:250px; } #second { border:1px solid red; background:white; width:250px; height:auto; float:right; margin-left:15px; }
thanks
EDIT:
let's say I use this instead of the wordpress sidebars: I still can't get it to work, can someone take a look with this simple code? There are 2 boxes: green and red ...
<!DOCTYPE> <html> <head> <meta charset="UTF-8" /> </head> <body> <div style="position:relative; width:700px; margin:0 auto;"> <div style="width:auto; border:1px solid green;">i would like to have a container (with some text) on the left of the page, that adapts itself with the space available, and 2 sidebars following on the right (i'm using Wordpress). (The 2 sidebars work fine with float. ) So i tried width:auto on the container. But it does not adapt itself with the rest of the space available (it takes all the page width). If i set the width to 70%, it fits the space on the index page, but if i click on an article, i only have 1 sidebar left, so there is a blank space between the text and the sidebar.</div> <div style="width:20%; float:right; border:1px solid red;">blablabla</div> </div> </body> </html>
source share