Forum Moderators: not2easy
There is one thing I'm not really able to do, and was wondering if someone could help.
Before, I used to have tables to design my sites, and I like to have my content always centralized on the middle of the screen, no matter what video resolution people are using. I used to do that with a main table set to 100%, with 3 columns, and I use the middle colum to setup the entire site.
Now, I'm using what we could call layers or positioning boxes, and all the coordinates are related to the left or top of the page, making it impossible (to my eyes) to centralize it. I'm pretty sure there is something I'm not seeing. Probably the positioning been relative or something.
Here is the code I'm using on my css file to be used by the divs.
#hh_Header {
position:absolute;
left:33px;
top:14px;
width:780px;
height:125px;
z-index:1;
}
goes on for every other positioning divs i use, but I think u guys can get the idea.
So, is the a way to have this div always on the middle of the screen no matter the resolution?
Thanks in advance for any help
I have this setup for the page that goes like the following:
Header div (780px)
Header nav div (780px)
Left column nav div (150px)
center column content div (500px)
Right column nav div (130px)
Footer div (780px)
=======================================
¦ Header Div (780) ¦
=======================================
¦ Header Nav Div (780) ¦
=======================================
¦ ¦ ¦ ¦
¦ L ¦ C ¦ R ¦
¦ E ¦ E ¦ I ¦
¦ F ¦ N ¦ G ¦
¦ T ¦ T ¦ H ¦
¦ ¦ E ¦ T ¦
¦ D ¦ R ¦ ¦
¦ I ¦ ¦ D ¦
¦ V ¦ D ¦ I ¦
¦ ¦ I ¦ V ¦
¦ ¦ V ¦ ¦
¦ ¦ ¦ ¦
=======================================
¦ Footer Div (780) ¦
=======================================
(cant use spaces to make it look like real =/ )
So, it's ok to align using the margin:auto the full row divs, but I need to precisely position the 3 columns, and still keep them centralized. That would be very easy using tables, but thats what I'm trying to avoid. I want to have it all in css.
Thanks in advance any help
[edited by: Tiruak at 5:58 pm (utc) on July 19, 2007]
[edited by: DrDoc at 6:16 pm (utc) on July 19, 2007]
[edit reason] fixed page layout example :) [/edit]
Other than that... all your really asking for seems to be a simple 3 column layout, right? There's all sorts of imformation on that stuff on this website, and everywhere else on the internet. Just search for "3 column layout"
Table based designers converting to CSS typically try using position:absolute lots. This is not a good habit to do, and should only be used when necessary.
An easy way to get a 3 column layout is to use floats. Float the two shortest columns and set their height to 100% (best make sure the container of the 3 columns has position:relative to establish container block), and assign all 3 their width.
There are also more complicated methods, such as ones which allow any column to be the highest.
[edited by: Xapti at 8:20 pm (utc) on July 19, 2007]