PDA

View Full Version : How can I have 2 divs next to each other with one expanding to fill the screen?



Magiccupcake
23 Jun 2009, 04:12 PM
I need to have two div tags next to each others. The left one needs to be 150px and the right one needs to stay next to it and fill the rest of the page.

The left one also needs to stay the same height as the right.

I can't seem to get percentages for the width to work the way I need it to. I tried wrapping them both in another div. I just can't seem to figure it out.

Thank you.

Wickham
24 Jun 2009, 01:09 AM
I need to have two div tags next to each others. The left one needs to be 150px and the right one needs to stay next to it and fill the rest of the page.

That looks like item 10 here http://www.wickham43.net/threecolumns.php but divs will be unequal height.


The left one also needs to stay the same height as the right.



If they are both fixed heights, just give them the same height, but if you want flexible heights each div will only show a background for the height of its content unless you use one of these codes:-

items 16a, 18 or 19 http://www.wickham43.net/firefoxbackground.php
Item 16a nests the div with the most height inside the shorter div so that the background of the shorter div is pulled down to the height of the other div.
Item 18 uses an image repeated vertically. Item 19 uses position: absolute divs with a background behind the content divs.