Skip to main content
gamedev.net
🔒 Locked

[web] Stupid CSS question ...

Started by b2therizzo 2 replies 1.1k views
Original Post
b2therizzo
b2therizzo
At least I think its stupid. Maybe I'm oversimplifying the problem ... Any ways I want to make a 2-column layout and I used to do them all the time with tables. However I have recently read (yes I am behind the times) that using tables like that is a big no-no in the web2.0 world. The reason I used to use tables all the time was because you could specify on table cells absolute width and just make the other table cell's width be a "*" and that cause that cell to stretch to fill the screen. Anyways now that I'm using CSS to achieve this effect, I can't seem to give one column an absolute width and make the other stretch ... Here's some code: #header { background-color:#EDEDED; } #content { background-color:#DEDEDE; float:left; width:80% } #sidebar { background-color:#CCCCCC; float:left; width:20% /* I want to make the sidebar a specific width and the content stretch to fill */ } #footer { clear:both } Anybody know something that I don't ...
DumitruSorin
DumitruSorin
shouldn't you specify some positioning.
Right now o think they would be overlapping
Sander
Sander
There are a lot of ways to get the layout you want. Two off the top of my head:

1) float a fixed size sidebar left. Give the content a left margin equal to the sidebar width

2) float the sidebar left. Give the page a left padding equal to the sidebar width and push the sidebar on the padding with a negative left margin.

For loads more examples on two column layouts see the css-discuss wiki page on two column layouts.
b2therizzo
b2therizzo
thanks ... much appreciated.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.