Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create web page that is always centered

Status
Not open for further replies.

goitc7

IS-IT--Management
Dec 4, 2008
17
US
I am using Expressions Web and would like to create a web page that is always centered that would be the "container" for all other elements and then build a table on top of it to have the different sections i.e. top for title then navigation on the left and section in the middle and the bottom section for some links. Is there a short answer to how to make this happen? I have tried some things with styles and nothing works consistently.
Thanks
 
What have you tried?

Searching fixed width layout I find many solutions. Most of them suggesting a div with width: XXXpx; margin:0 auto;

Bye, Olaf.
 
Try with
margin: 0 auto;

at the highest level of your css.

Cheers,
MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
MakeItSo said:
Try with
margin: 0 auto;

at the highest level of your css.

Along with a fixed width of less than 100% or a value in pixels|ems of course.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
OK. Thank you all. That seems straighforward. Is the best fixed width for today's monitors something shy of 800 wide? Maybe 780 pixels?

 
800px is too small. I don't know anyone with less than 1280px, even netbooks rather have higher dpi than resolutions lower than 1280px.

Who would profit of 800px is smartphone users, perhaps. But even they have 1280px or more today.

You don't need to specify a typical monitor width, you can choose whatever you like, I used 960px for one site, leaves space for some nice margins, a background image can use that space. And pepole with wider screend can zoom in via [CTRL]+[+] or resize their browser and have space for some other app beside it.

Go for whatever best fits your layout, and if you don't have a reason for the fixed width from the layout, then why bother at all? Then make it a fluid layout.

Bye, Olaf.
 
For example, why 960px is nice:

960's prime factors are 2^6*3*5, so you can divide it into 2,3,4,5,6,8,10,12,15,16 equal wide columns, which gives a lot of options for layout proportions overall and in detail in tables or arrays of eg thumbnails or anything displayed in a grid layout. Typical screen widths like 800, 1024, 1280, etc. are not having such nice integer factorizations.

At 1280px screen width, 960px leaves 320px, which means a margin of 1/6th left and right, this also has a nice eye appeals.

800px eg is 2^5*5*5, so you eg can't divide it by 3 exactly. Of course you can say 266+268+266=800 is good enough, but it's nicer to not have +/- differences in widths.

Bye, Olaf.

 
Thank you all so much - I think I will try the 960.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top