Why is my header not centering? (HTML 5, CSS)

Discussion in 'Tech & Support' started by Sundancer, Mar 11, 2013.

  1. Sundancer Cynicist

    Joined:
    Feb 16, 2004
    Messages:
    3,208
    Likes Received:
    197
    Here is the code below in HTML 5. I'm also trying to figure out why my browser (Firefox) isn't adding margins.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>HTML Example</title>
    <meta charset="utf-8">
    <style>

    body { background-color:#d1affe;
    font-family:Arial, Verdana, sans-serif
    margin-left: auto
    margin-right:auto;
    )

    p { font-size:.90em;
    text-indent: 3em;

    h1 {text-align: center;
    font-family:Georgia, "Times New Roman", serif;
    }

    h2 {text-align: center;}

    </style>
    <body>
    <h1>John Smith</h1>
    <br>
    <p>Welcome to my demonstration of HTML format! Knowing basic HTMl and formatting for
    Web pages is essential for many librarians. I have had several library positions though I have yet to be in one in which I create
    Web content. That is a reason to learn. Libraries now thrive on technology for communication, providing information and outreach
    purposes. Here are the library titles I've held over the years:</p>
    </body>





    I found a similar code that does work. I don't see the difference.



    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>Trillium Media Design</title>
    <meta charset="utf-8">
    <style>
    body { background-color:#E6E6FA;
    color:#191970;
    font-family:Arial, Verdana, sans-serif;
    }
    h1 { background-color:#191970;
    color:#E6E6FA;
    line-height: 200%;
    font-family:Georgia, "Times New Roman", serif;
    }
    h2 { background-color:#AEAED4;
    color:#191970;
    font-family:Georgia, "Times New Roman", serif;
    text-align: center;
    }
    p { font-size:.90em;
    text-indent: 3em;
    }
    ul {font-weight:bold;
    }
    </style>
    </head>
    <body>
    <h1>&nbsp;Trillium Media Design</h1>
    <div><a href="index.html">Home</a> <a href="services.html">Services</a> <a href="contact.html">Contact</a></div>
    <h2>New Media and Web Design</h2>
    <p>Trillium Media Design will bring your company's Web presence to the next level.
    We offer a comprehensive range of services: </p>
    <ul>
    <li>Website Design</li>
    <li>Interactive Animation</li>
    <li>E-Commerce Solutions</li>
    <li>Usability Studies</li>
    <li>Search Engine Optimization</li>
    </ul>
    <h2>Meeting Your Business Needs</h2>
    <p>Our expert designers are creative and eager to work with you.
    Take advantage of the power of Web 2.0!</p>
    <div>Copyright &copy; 2012 Your Name Here</div>
    </body>
    </html>
     
    #1 Sundancer, Mar 11, 2013
    Last edited: Mar 11, 2013

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
monitoring_string = "afb8e5d7348ab9e99f73cba908f10802"