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!

How can I centre my Web page?

Status
Not open for further replies.

dazle321

Technical User
Oct 9, 2008
2
AU
I have a Web site which states at the bottom "This site is best viewed at 800 X 600 with I.E 5 & above" It has been fine until recently I purchased a new pc with a wide monitor screen. Now my site stretches right across the screen so much so it looks strange. Yet some other sites I view are actually centred with an area of colour down each side.
Is it possible to alter my site so it can be centred and not spread out across the monitor screen like this one?



Thanks. Dazle321
 
It looks ok to me in IE6. I suggest a full and valid doctype as the first entry in your html file. (Followed by the html tag). Otherwise display will default to quirks mode and cross browser consistency is virtually unattainable.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title>L&amp;M Group of Companies - Electrical Appliances for the Hospitality Industry</title>

Your current file has a comment before the opening html tag:
Code:
<!-- Last Updated Jul 11th,2008 16:06:30 -->

<html>

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Without seeing your website it's difficult to be specific, but if you want a fixed width site that remains centred in the browser window you need to include all the visible elements in a div with a fixed width and with margin set to auto.

This of course will only work if you also follow traingamers advice and supply a full and valid doctype. You should also make syre that your site validates using
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Duh.
I thought the web site referenced was the one the poster meant. [blush]


See Centering: Auto-width Margins among many other references.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 

thanks guys for replying. A little technical for me however will try my best. Thanks again. Best wishes Dazle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top