Home All Posts FAQs Lijit Search

If you are new to Blogger Sentral, you may want to subscribe to our RSS feed or get the latest articles sent to your Email.

For questions or post-unspecific comments please use the questions/comments gadget on the right sidebar.


Aligning header image and texts

July 12, 2009

If you upload your header image via Page Elements, Blogger will automatically align it to the left. There are no options for middle and right alignment. So then, it possible to align the image in at the center or to the right of the header?

Yes it is possible -using CSS (Cascading style sheet). But to define an element in CSS you must know the element id or class name. After some checking I found the id for header widget contents to be header-inner. So what’s next?

You need to check the image placement method you used when uploading the header image to Blogger. Different method handles the image differently, thereby requiring different code for alignment.

header image1

Once header image placement is known, it’s time to add in the code.

  1. Go to Dashboard > Layout > Edit HTML.
  2. Look for ]]></b:skin> line in your HTML code and add the following codes right before it:

1. If you used “Behind title and description” option

Your image is posted as a background by Blogger, to align it you need to reposition the background image. This code will not move the header title and description. For header title and description, see Aligning header texts.

  • To center:
    #header-inner {background-position: center !important; width: 100% !important;}
  • To align right:
    #header-inner {background-position: right !important; width: 100% !important;}

2. If you used “Instead of title and description” option

The image is posted using an <img> tag.

  • To center:
    #header-inner img {margin: 0 auto;}
  • To align right:
    #header-inner img {margin: 0 auto 0 300px;}
    You need to adjust the left margin (300px in this example) to “push” the image to the right.

For option 1 and 2 to work, your header image width (plus margin and padding if any) must be equal or less than the container (such as header-wrapper, outer-wrapper etc.) width.

 

Aligning header texts

Use the codes below for aligning header title and description. The codes are applicable to both text-only header and the text in “Behind title and description” image placement option.

  • To center:
    #header-inner {text-align: center ;}
  • To align right:
    #header-inner {text-align: right ;}

Enjoy!

 

Before you leave:

  • Do you find this article useful? Share it via Tweet This or Add This buttons below.
  • Any suggestion, question or comment? Please post it in the comments below.

    23 comments to "Aligning header image and texts"

    PA Systems July 31, 2009 12:30 AM  

    Where do you put the header alignmment codes? I can not find the specific text in the code that looks similar to the codes you place up here.

    Greenlava July 31, 2009 2:03 AM  

    You add the codes just before
    ]]>< /b:skin > line in your template HTML.
    BTW your blog header is located in the sidebar. If you use the code above the title won't center accross the blog, it will only center within the sidebar.
    If you want to center it accross the blog you need to add a header-wrapper.

    Greenlava September 15, 2009 12:59 AM  

    PROSTEC,
    The horizontal alignment looks okay to me.
    Or are you talking about the blog title and description overlapping the logo?
    To put them on top of the logo just add:
    height: 600px !important;
    inside #header-inner { }

    Greenlava October 6, 2009 3:00 PM  

    Program Sukarelawan Teknologi (PROSTEC),
    Welcome back.
    You can define the size of your header logo by adding width and height properties inside the #header-inner img, for example like this:
    #header-inner img {margin: 0 auto; width:300px; height:300px;}

    Paul Arthur October 21, 2009 6:12 PM  

    how about for example if it is centered and then it moves off center in the post comment page ex:http://www.paularthurmusic.com/2009/10/u2-to-stream-concert-live-on-youtube.html

    paularthurmusic@gmail.com

    Always Home and Uncool October 24, 2009 6:33 AM  

    I have a stretch demin template I reconfig to 3 columns and I have never been able to center the hedder image, this way or else. Any help?

    Greenlava October 24, 2009 3:58 PM  

    Always Home and Uncool,
    I see you've settled the problem. Thanks for dropping by.

    Always Home and Uncool October 24, 2009 8:51 PM  

    Yeah, after all this time, I figured it out right after I left you a note. Sorry for the bother.

    Mom with a Mission November 9, 2009 8:51 AM  

    I reconfigured to a 3 column format and can't get the header centered. I added the "aligning header text" code that you recommended, but it didn't make a difference. I'm a novice and can't figure this one out. Blog is www.peanutclinicaltrial.blogspot.com. I'd appreciate any advice. Thanks.

    Greenlava November 9, 2009 9:07 AM  

    Mom with a Mission,
    The header description is centered allright, but it's container is narrower than the header and is left aligned. To fix it, find this:

    #header .description {
    margin:0 5px 5px;
    padding:0 20px 15px;
    max-width:700px;
    text-transform:uppercase;
    letter-spacing:.2em;
    line-height: 1.4em;
    font: normal normal 78% 'Trebuchet MS', Trebuchet, Arial, Verdana, Sans-serif;
    color: #a9501b;
    }

    and change max-width to 100%.

    quality web hosting November 10, 2009 8:44 PM  

    How do i html a header image/text, if i want it in the center but aligned to the left of an image below?

    Greenlava November 10, 2009 9:36 PM  

    quality web hosting,
    Sorry, this tutorial is only applicable to Blogger blogs. Yours is Wordpress.

    Now it's your turn to say something

    Reciprocals

    Add to Technorati Favorites Bloggers & Blogging Blogs - Blog Catalog Blog Directory BlogKelate BlogMalaysia.com Kelantan Bloggers
    Himpunan Blog Malaysia Blog Kita All Malaysian Bloggers Project Blogged.my

    Privacy Policy

      ©The Professional Template by Ourblogtemplates.com 2008 Tuned by GreenLava

    Blog Widget by LinkWithin