![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The advantage of this is that the left column would only be wide enough to fit the links, and the right column would expand to fill the rest of the window (assuming it had enough content of course). I have been looking to do such a layout in CSS, but can't see how. All the examples I've seen use DIVs for the columns, and float them. They set the width of the left DIV either as a fixed value in pixels, ems, etc, or as a percentage. Either way, the left column's width is independent of the contents. If the text of the links are all short, then you waste space in the left column. If there are long texts, they overflow the DIV and spill into the right column. http://css-discuss.incutio.com/ |
#3
| |||
| |||
|
| http://www.csszengarden.com/ |
| http://css.maxdesign.com.au/ |
#4
| |||
| |||
|
|
table border="0" cellpadding="0" cellspacing="0" width="100%" tr td align="left" valign="top" small a href="...">Ferrets</a br><a href="...">Gibbons</a br><a href="...">Voles</a /small /td td align="left" valign="top" This is where the main content goes... /td /tr /table .... Is there any way to set it so that the left column is only as wide as needed by the contents, and the right one uses the rest? |
|
TIA |
#5
| |||
| |||
|
|
Thanks for your links Jim, but I've been through those already, and unless I missed one, none of them do what I want. They all have either fixed width, or a fixed percentage. I'm looking for a way to have the left column (DIV) only take as much space as the contents need, and have the right column take the rest. Hmm. There is the float suggestion by Niels. That would work. |
#6
| |||
| |||
|
|
Is there any way to set it so that the left column is only as wide as needed by the contents, and the right one uses the rest? Your table-solution doesn't fit your description, the link-column is maybe at about 20% for me. |
|
Try to understand floating and div and you get exactly what you want: snip |
#7
| |||
| |||
|
|
Thanks for your links Jim, but I've been through those already, and unless I missed one, none of them do what I want. They all have either fixed width, or a fixed percentage. I'm looking for a way to have the left column (DIV) only take as much space as the contents need, and have the right column take the rest. Hmm. There is the float suggestion by Niels. That would work. |
|
You could also try display: table-cell. I do not know if IE supports that, though. |
#8
| |||
| |||
|
|
I tried adding style="float:right;" to the main content div, which gave something a lot closer to what I wanted in IE, but put the div *below* the links on in Firefox, so still no joy ;-( |
#9
| |||
| |||
|
#10
| |||
| |||
|
| http://css.maxdesign.com.au/ I presume you were referring to the floatutorial. Again, AFAICS, no example of automatic sizing. It could be that CSS simply isn't up to this yet and I'm going to have to stick with tables a while longer. If anyone has any idea, please reply. TIA. |
![]() |
| Thread Tools | |
| Display Modes | |
| |