01-05-2010, 10:18 PM
Hi guys, I'm new to this whole world of CSS and web design and was wondering if anyone could help me? I'm trying to center my background image but it doesn't seem to be in line with my header image that is centered, it goes slightly left of it. My background is the same width as my header so I don't know what is going on!
The page is here:http://grahamethomson.com/About_me.html
And the linking css is here:http://grahamethomson.com/design.css
Thanks for any help. :)
01-06-2010, 01:13 AM
Those links are dead.
01-07-2010, 03:31 PM
Please visit the following sites to see if they can help you out:
Hope this helps!!!
01-07-2010, 03:34 PM
I think the css file is
01-07-2010, 04:33 PM
There is something odd about your DocType.
To center an element we need 3 things:
a DocType declaration
an element with a width
that elements right/left margins set to auto
Your code has those 3 things, but still doesn't work until I changed the DocType. You also have an error in the line that links your CSS file.
Make the top of your markup look like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Center test - no "text-align: center" set for body</title>
<link rel="text/css" href='auto.css' />
01-08-2010, 12:56 PM
Thanks for the help guys, managed to solve the problem. Needed to set the width. Am new to all of this but getting there.
01-08-2010, 04:25 PM
Glad you got it fixed! The online version has not been updated so we can't see it in action yet.
That validator mentioned in my sig below can help find mistakes like this -