newbie question

Discussion in 'CSS' started by jhooga, Apr 26, 2010.

  1. #1
    I am trying to get my header centered and i cant seem to get it to move over with all the other code ive tried online. Idk if you need both documents but here is the one with the tag in it. Its Tech Central <h1>

    <html>
    <head>
    <link href="style.css" rel="stylesheet" type="text/css">
    </style>
    </head>
    <body>

    <div id="container">

    <div id="header">


    <h1>Tech Central</h1>



    <div class="HorizLinks">
    </div>

    </div>



    <div id="horizontalnav">

    <div class="navlinks">

    <ul>
    <li><a href="http://www.website.com">Home</a></li>
    <li><a href="http://www.website.com">Contact</a></li>
    <li><a href="http://www.website.com">About</a></li>

    </div>

    </div>





    <div id="leftnav">
    <div class="VerticalLinks">
    <ul>
    <li><a href="#desktops">Desktops</a></li><br>
    <li><a href="#laptops">Laptops</a></li><br>
    <li><a href="#accessories">Accessories</a></li>
    </ul>

    </div>
    </div>






    <div id="body">This is the body</div>

    <div id="footer">This is the footer</div>

    </div>


    </body>
    </html>
     
    jhooga, Apr 26, 2010 IP
  2. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #2
    set the margin of left and right to auto. In the styles,

    #header { margin:0 auto;}

    This centers the div #header. However as the width is not mentioned by default it's 100% of your browser. set an width you will find div # header is centered to the browser.
    #header { margin:0 auto; width: 960px;}
     
    radiant_luv, Apr 26, 2010 IP