Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    45
    Thanks
    6
    Thanked 0 Times in 0 Posts

    CSS Background Center

    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
    http://grahamethomson.com/Background.css



    Thanks for any help.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,740
    Thanks
    22
    Thanked 1,837 Times in 1,821 Posts
    Hello whatg,
    Those links are dead.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Oct 2009
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hello,

    Please visit the following sites to see if they can help you out:

    http://www.wpdfd.com/issues/70/css_from_the_ground_up/
    http://www.csszengarden.com/
    http://www.alistapart.com/topics/design
    http://www.w3schools.com/css/default.asp

    Hope this helps!!!
    CoffeeCup.com

  • #4
    Regular Coder boogily's Avatar
    Join Date
    Jul 2009
    Posts
    275
    Thanks
    18
    Thanked 4 Times in 4 Posts
    I think the css file is

    http://grahamethomson.com/auto.css

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,740
    Thanks
    22
    Thanked 1,837 Times in 1,821 Posts
    Goodmorning whatg,
    There is something odd about your DocType.
    To center an element we need 3 things:
    1. a DocType declaration
    2. an element with a width
    3. 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:
    Code:
     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Center test - no &quot;text-align: center&quot; set for body</title>
    <link rel="text/css" href='auto.css' />
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #6
    New Coder
    Join Date
    Jan 2010
    Posts
    45
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Thanks

    Thanks for the help guys, managed to solve the problem. Needed to set the width. Am new to all of this but getting there.


    Thanks again!

  • #7
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,740
    Thanks
    22
    Thanked 1,837 Times in 1,821 Posts
    Goodmorning whatg,
    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 -
    Code:
    body{
    	baclground color:black;
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •