I need help with this code

Discussion in 'CSS' started by theblurr5495, Dec 19, 2008.

  1. #1
    I'm sorry if this is a nooby question but i have this code and couldn't find the answer online.

    <div id="center">
    <h1 Home of Soccer </h1>

    How do i align my header into the center of the page.

    Thanks
     
    theblurr5495, Dec 19, 2008 IP
  2. SFOD_D223

    SFOD_D223 Peon

    Messages:
    4,512
    Likes Received:
    174
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <div id="center">
    <center><h1> Home of Soccer </h1></center> - might be overkill, but try that.
     
    SFOD_D223, Dec 19, 2008 IP
  3. theblurr5495

    theblurr5495 Active Member

    Messages:
    436
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #3
    thank you for your advice
     
    theblurr5495, Dec 19, 2008 IP
  4. caribbean_hatch

    caribbean_hatch Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The center tag was deprecated in HTML 4.01, you should use:

     
    caribbean_hatch, Dec 19, 2008 IP
  5. designz

    designz Peon

    Messages:
    301
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If you are using css Then this should be of use.



    
    /*----Div Id Center , Specify Height & Width of the container and all elements within the container Id center will be centered----*/
    #center{
    width: xxx;
    height: xxx;
    text-align: center;
    }
    
    Code (markup):
    But just incase you have done something wrong. This will work

    
    h1 {
    text-align: center;
    }
    
    Code (markup):
    Html Code would simply be

    
    
    <div id="center">
    
    <h1> Text Goes Here</h1>
    
    </div><!--End Of Center-->
    
    Code (markup):
     
    designz, Dec 19, 2008 IP