Need to Align Page Titles to the Center

Discussion in 'HTML & Website Design' started by ademmeda, May 16, 2010.

  1. #1
    Hi,

    I am working on a wordpress site (samsalesman.com) and need to align the page titles such as the following site: (kohayoga.org) I tried many things both on the header.php file and stylesheet but no success, does anybody have an idea on how to do this?
     
    ademmeda, May 16, 2010 IP
  2. l2yan

    l2yan Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Heading elements are an inline element so you need to wrap it into a div block and create a class that aligns to the center, i.e.

    <div class="center">
    <h1>Foo Title</h1>
    </div>

    # style.css
    .center { text-align: center }

    or you could convert the h1 tag to a block with a width etc but that is a little more complicated.

    Hope that helps...
     
    l2yan, May 16, 2010 IP
  3. grandpha

    grandpha Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You should close in a div and make a class and tlign ur text in center
    <div class="center">
    <h1>Your text</h1>
    <h2>Your text</h2></div>
    # style.css
    .center { text-align: center }




    or may b this will help u




    .aligncenter,
    div.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    }

    .alignleft {
    float: left;
    }

    .alignright {
    float: right;
    }

    .wp-caption {
    border: 1px solid #ddd;
    text-align: center;
    background-color: #f3f3f3;
    padding-top: 4px;
    margin: 10px;
    /* optional rounded corners for browsers that support it */
    -moz-border-radius: 3px;
    -khtml-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    }

    .wp-caption img {
    margin: 0;
    padding: 0;
    border: 0 none;
    }

    .wp-caption p.wp-caption-text {
    font-size: 11px;
    line-height: 17px;
    padding: 0 4px 5px;
    margin: 0;
    }
     
    grandpha, May 17, 2010 IP
  4. www.CaseyEquip.com

    www.CaseyEquip.com Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you want to align container with text, pictures and whatever else use this code:

    <div style="margin: 0 auto; width:900px;">
    your text, pictures, etc.
    </div>
    Code (markup):
    900px is width of the container that will be centered on the page.

    Best wishes!
     
    www.CaseyEquip.com, May 17, 2010 IP
  5. ademmeda

    ademmeda Active Member

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    70
    #5
    Sorry but none of them worked.
     
    ademmeda, May 18, 2010 IP
  6. www.CaseyEquip.com

    www.CaseyEquip.com Peon

    Messages:
    97
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Dude, if you are complete beginner take few tutorials before saying that it doesn't work.

    This is code of container from that Yoga website
    #container {
    margin:15px auto 0;
    width:970px;
    }
    Code (markup):
    few nested divs, with main container with id="container"
     
    www.CaseyEquip.com, May 18, 2010 IP