Add icon beside Sidebar title (heading)

February 10, 2009

This time, we'll learn how to place a small icon or picture right beside the Sidebar widget/gadget title...
In the article Blogger sidebar titles customization, you saw how to customize the background of the titles, add some borders to it, or replace it with picture..
Now, we want to achieve this:
There are 4 steps to get this working:

1. Find the icon (picture) you like, optimize it
2. Upload the pic to a free web host (to get the URL)
3. Make a CSS style for the sidebar headings (titles)
4. Play with the CSS style (customize)

***

1. This is a fun part. Find the pic (icon) you like, design one, crop it, cut it, color it.....Two things you should take care of:

size of the icon - keep them small, like 25x25 px...This is not a rule, and the ratio is not important (you can make 25x10px..). Trial and error. You'll get it...
transparent pic or not? - I suggest NOT to use transparent pics. Rather make a pic with a background that has same color as your sidebar background color (so they blend together).
Transparency is great, but older Internet Explorer browsers do not display them properly. And lots of folks out there are using those. Still....

***
2. When your pic is ready, next thing is to upload it to a free web host. We do this in order to get the direct link of our hosted pic, so we can use it (link to it) from our template...Free picture (image) hosting providers (my favorites):
photobucket.com
tinypic.com

Create an account, upload pic and get the link (direct link)...

***
3. Now, we have to create the style for the sidebar headings in Blogger HTML. Don' worry, it's just cut-paste job...with a little tweak..
Default style for sidebar headings (titles) already exists in templates, but in default Blogger templates (like Minima) it defines the style for the date heading also. So, we have to divide those styles...Anyway, you can either have a:

default Blogger template (the one from Blogger Pick a new template) - you'll have no problem with this tutorial
customized, third party Blogger template - you'll have to identify your sidebar headings style in the HTML code (CSS), and then customize it...Usually, these templates already have a nice clean code, and the styles are divided, so, you won't have problems...

Here's what you have to do:
First, back up your Blogger template. Then go to LAYOUT ► EDIT HTML ► and insert the new code (in orange) ABOVE the existing code (in pink):
.sidebar h2 {
background:url(URL OF HOSTED PIC);
background-repeat: no-repeat;
background-position:left center;
height:25px;
margin:0;
padding:10px 3px 0 30px;
line-height:1.5em;
text-transform:uppercase;
letter-spacing:.2em;
}


]]></b:skin> </head>

***

4. Let's analyze (and customize) our new sidebar heading (title) style:

► you have to replace URL OF HOSTED PIC with your uploaded picture (step 2)
► adjust the height corresponding to your picture (icon) height...if your pic height is 40px, then the line would be height:40px;
► with padding, you can adjust your title (textual part):

...for example, if you increase top padding to 20px, this will push the title down,
...and if you decrease left padding to 20px, this will pull the title to the left...
...it seems weird, but you'll get it..

► with other styles (you can also add some more) you can adjust the uppercase (CAPS) to lowercase, letter spacing (space between letters in title)...

That's it! If you'll have some troubles, scream! I'll help.

post signature

Face It! Tell Your Tweets Digg It! Add to Delicious Stumble Upon I Reddit! Mixx it Up! Add to Your Faves

40 comments:

vila dines said...

Thank you for the tutorial. You really inspire me to create my own layout with your easy to understand tutorial =)

Can you show us how to add own icon on the tab instead of boring blogger icon =P

pocket said...

hey vila....

I'll make a tutorial. I promise...But there's also a lot of quality tuts on the web. Just search for the favicon in Blogger...
Smile!

Anonymous said...

Hey,
So how do you make a different picture in each sidebar title?
Thanks,
S.T.

pocket said...

Basically, you have two options:
1. locating the heading of individual widget in code section, and change the default data with your own (pictures also work)
2. create a CSS style for each widget heading you'd like to customize...Style has to carry the same ID as the widget..Then, you can easily place different backgrounds and different styles for each widget/gadget..

The tutorial is coming, so you can also wait for step-by-step info...

Smile!

Mahbub said...

Hi ,
Can you plz give us a tute for menu bar !

♪Tobi♪ said...

for a favicon, do you kno if im supposed to put the code after the h e.a d> or before the h e.a d/> (take out spaces and periods and add < at the beginning of each)

if its the second one, where would it be??? i made a favicon but its not showing up!! i dont know what to do.

pocket said...

Mahbub, tut is coming soon...

♪Tobi♪, read this article:
Favicon Bloggger

আবদুল্লাহ আল মাহবুব said...

Thanks mate

jesgo said...

Good post.

♪Tobi♪ said...

aww.... nothing for favicons work for me. it just tells me that the code isnt used correctly....=(

♪Tobi♪ said...

< li. nk hr.ef='/fav.icon.ico' rel='http://4.bp.blogspot.com/_tP0xDWykths/SZJWpySEwJI/AAAAAAAAALg/YJ6xVbKJCD4/s320/fav icon.ico'/>

thats my code right after < he.a d> (take out periods and spaces in link, href, and favicon and head)

still wrong?

pocket said...

Tobi,

I'm sorry. I've never tried to add a favicon. When I do, I'll make a nice tut.
Check the link from my comment above and follow instructions. You should do fine...

vila dines said...

My layout is 80% done but the thing is I can't view my site feed (i'm not sure if others can view it tho). When i click on it, it appeared like this:

http://i17.photobucket.com/albums/b99/aviLapple/feed.jpg

It was ok before. whats wrong?

pocket said...

Hey vila dines....Yup. It works. Here's how I see it:
http://i41.tinypic.com/2rmm4cn.jpg

:]

mattress monster said...

cool tutorial...thanks for help. up and running in super quick time. cheers

renee said...

pocket - This worked great but the icon is next to my date by the post title too....How do I remove it from the date?

pocket said...

renee,

..can't tell like this. I'll have to take a look at your Blog. The problem seems to be that date and sidebar headings are using the same style. In part 3 of the tutorial above, you can see we added a new style for sidebar especially, to avoid conflict with the date....
:|

Nandy said...

hi admin..awesome blog!:)

I am new to blogging.i am trying to customize revolution church blogger template.The posts body has blocks(separate boxes) for each post.I want to make it into a single background with thick separators for each post.
Also i want to add the "comments" link for the post to be in the separators instead of the top(as in revolution church).hope u can help me out..
good day!:)

ritesh kedar said...

this blog is quite nice.....i really like tutorials here......always visit here

Elena said...

Hello! How can I add the buttons in the header, not in the sidebar ?

Nurul Lestrange said...

OMYGOSH

I did this to put before my blogpost date, and it really worked!

Steller*Zeller said...

hi!! i didnt have that code in my html

Anonymous said...

hi

kAt said...

I don't have any of the two codes in my HTML.

Is there anything I can do to add these? I would really like to put a picture next to my titles.

Thanks!

Matt said...

Rock on...thanks alot.

ahmed said...

hi i tried ur scrip but i showz the image but no title showing and it showz the same pic in my other sider bar widget i want other pic ok plz help me out

♥shumun♥ said...

why i dun hv ·h2 { geh??

Tomate Joyeuse said...

Thank you very much!! I like your blog!

Elly said...

yippie it works
check it out
http://www.ellyali.blogspot.com

Rotapple said...

Love this! and your full blog
It's been very helpful
Thank you for the tips!

von zwergen und feen said...

Hi Pocket,

first of all many thanks for all of you tutorials and help... I really love your blog and benefit of your easy decriptions. Did you yet manage to make a new step by step tutorial to change the title image for every single widget? I could fong one neather on your blog nor on google but perhaps I am a bit blind.

Many Thanks in advance
(o; Stephie

pocket said...

Hey Stephie...

:] Next tut is about that. Wait a few more days....

von zwergen und feen said...

Hey Pocket...
many Thanks for you quick answer!!!
I am looking forward to seeing your tutorial!

xo
Stephie

Julianna said...

How do I get the image below the title instead of to the side?

Megan said...

Thanks so much for the tutorial! :)
I got it to work for one of the sidebar titles....now how do I get the customized titles for each of my sidebar things?

Thanks!
-Meg

liennasts said...

thanks pocket.. it work.. and really change my boring blog.. take a view..

http://mylittleone-danish.blogspot.com/

Ammu Madhu said...

Hi pocket,

Is there any way to add image/icons before labels?
I wanna add different images to each label.

Ceci said...

Hi Pocket

I would like to know how to move my label tags NEXT to my date (this one I have below post title).

Thanks.
cukimuki.cl@gmail.com

Paddy Power said...

a cracking tutorial...easy to follow...cheers..

Vanessa D. Alexander said...

I continue to be amazed at how you can simplify coding for Blogger in a way for EVERYone to understand. You are a very good teacher. Just wanted to stop in and say thanks. No doubt I will be back (smile)

Say it...

Related Posts with Thumbnails