Aligning header image and texts
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.
Once header image placement is known, it’s time to add in the code.
- Go to Dashboard > Layout > Edit HTML.
- 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"
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.
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.
Thank you!
how to do it if in my case?
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 { }
Thanks
You're welcome zulica.
thanks greenlava..
how to about resize my logo to make it smaller?
how to do it?
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;}
hey..
thanks greenlava..
it really helps..
awesome blog!
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
Hey Paul,
I just answered your question in Blogger help forum.
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?
Always Home and Uncool,
I see you've settled the problem. Thanks for dropping by.
Yeah, after all this time, I figured it out right after I left you a note. Sorry for the bother.
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.
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%.
Thanks so much. That worked!
How do i html a header image/text, if i want it in the center but aligned to the left of an image below?
quality web hosting,
Sorry, this tutorial is only applicable to Blogger blogs. Yours is Wordpress.
Thanks a million that helped
Thank you, this did the trick!
Akshe, Branka Marinkovic-Forte,
My pleasure.
Now it's your turn to say something