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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trying to set my background to black and the text to white.

    What is wrong with my code?

    HTML:

    <html>
    <div id="head">
    <head>MY NAME IS __________
    <link rel="stylesheet" type="text/css" href="Stylesheet.css" />
    <title>A millionares diary!</title>
    </head>
    </div>


    <div id="h1">
    <h1>A MILLIONARE'S DIARY</h1>
    </div>

    <div id="body">
    <body>
    </body>
    </div>
    <ul id="nav">
    <li><a href="home.php">Home</a></li>
    <li><a href="aboutme.php">About Me</a></li>
    <li><a href="cars.php">My Cars</a></li>
    <li><a href="blog.php">My Blog</a></li>
    <li><a href="feedback.php">Feedback</a></li>
    </ul>


    </div>
    <div id="p">
    <p>Hello there, I am a millionare who brags about my journey on the internet
    so people like you can sit there are marvel at my glory. Feel free to click on any
    of the links below as they will take you to all of the pages you'll need to
    appreciate how amazing I am:</p>
    </div>

    </html>








    CSS:

    #p{font-family: "Trebuchet MS", arial, sans-serif;
    color: white;
    background-color:black;
    }

    #body{
    background-color:black;
    }

    #nav{
    width: 100%;
    float: left;
    margin: 0 0 3em 0;
    list-style: none;
    display:inline;
    a:link {color: yellow; background: black}
    a:visited {color: white; background: black}
    a:active {color: red; background: black}
    }

    #nav li{
    float: left;
    padding-left: 75px;
    }
    h1 {font-size 40pt;
    font-weight: heavy;
    letter-spacing: 4px;
    font-style: italic;
    text-align: center;
    color: white;
    background-color:black;

    }

    div.mainheading {height:100px; background-color: black





    Thanks and I hope you can help me

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    body is a keyword. Dont use is for id. change it and see.

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,748
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello 9adam4,
    Your document is not laid out properly, the body is what contains your markup and you close it too soon.

    While giving your elements id's like body, h1 and p is not invalid a more descriptive naming convention might help you.

    You have other errors as well. See the links about validation in my signature line. Validating is an easy way to catch errors like these.

    Look at a valid example of your markup -
    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=utf-8" />
    <link rel="stylesheet" type="text/css" href="Stylesheet.css" />
    <title>A millionares diary!</title> 
    </head>
    <body>
        <div id="h1">
            <h1>A MILLIONARE'S DIARY</h1>
        </div>
        <div id="body">
                <ul id="nav">
                    <li><a href="home.php">Home</a></li>
                    <li><a href="aboutme.php">About Me</a></li>
                    <li><a href="cars.php">My Cars</a></li>
                    <li><a href="blog.php">My Blog</a></li>
                    <li><a href="feedback.php">Feedback</a></li>
                </ul>
            <div id="p">
                <p>
                    Hello there, I am a millionare who brags about my journey on the internet
                    so people like you can sit there are marvel at my glory. Feel free to click on any
                    of the links below as they will take you to all of the pages you'll need to
                    appreciate how amazing I am:
                </p>
            </div>
        <!--end #body--></div>
    </body>
    </html>

    When posting code in the forum, please use the code tags, &#91;code&#93;&#91;/code&#93; - available with the # button in the post edit window.
    This will wrap your code in a scroll box which greatly helps the readability of your post.
    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
    •