Sidebar gadgets (widgets) in separate boxes

February 14, 2009

In the article Each Post in the separate box, we've learned how to divide our posts in the boxes using the same style that's present in the template.
Now, we'll do the same for the Sidebar elements - widgets (gadgets). The idea is the same. We'll separate one from another, and each of them will have a house :]

Demo: Gadgets in separate boxes

You should keep in mind:

► this is the example for the Blogs that already have a customized (stylized) Sidebar (colorized, borderized..)
► this example was made in Minima Blogger template (so your code may be a bit different, but the procedure is the same)
► it doesn't matter if you have "heavily" customized template, you can apply these setting anyway

UNDERSTAND THIS
We have to imitate the main style of our sidebar-wrapper (the one that carries the style for the whole sidebar element), and apply it to individual widgets (gadgets). Here's the style of the sidebar-wrapper in this example:
#sidebar-wrapper {
background:#ADD8E6;
border: 1px solid #E9967A;
width: 220px;
float: $endSide;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
...the styles we're interested in here are: background and border
...next is to apply this to our widgets...

Ok, LET'S DO IT
First, back up your current Blogger template. Then, go to: LAYOUT ► EDIT HTML ► and locate this part in the code (this is for default Minima blogger template, it may look a bit different for you):
.sidebar .widget, .main .widget {
border-bottom:1px dotted $bordercolor;
margin:0 0 1.5em;
padding:0 0 1.5em;
}
...DELETE it, and replace with this one:
.sidebar .widget {
background:#ADD8E6;
border: 1px solid #E9967A;
margin:0 -5px 1.5em -5px;
padding:5px 7px 5px 7px;
}

.main .widget {
border-bottom:1px dotted $bordercolor;
margin:0 0 1.5em;
padding:0 0 1.5em;
}
...we've divided the main widget and sidebar widget in order to apply the style...
...in pink, you can see the copied style from sidebar-wrapper...
...in green, you can adjust the padding of the widget content (if the padding was 0px, the text would be to close to the border)..

► Next thing is to delete (hide) the style from the sidebar-wrapper. Why? Because if you don't, your sidebar will look like this:
To avoid this, find the sidebar-wrapper:
#sidebar-wrapper {
background:#ADD8E6;
border: 1px solid #E9967A;

width: 220px;
float: $endSide;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
...and DELETE the background and border (or any other style you've applied to your widgets/gadgets):
#sidebar-wrapper {
width: 220px;
float: $endSide;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
...that's it.

post signature

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

51 comments:

Radith Prawira said...

Finally, you bring up the discussion in the previous article ( each post in the separate box ) into an own separate article itself :p

But sure it's a great trick! :)

--

may i ask somethin? i have a 300px width sidebar and i like it.. but i want to make a 150px-width below it. side to side.

--

Always a pleasure for visting your site :)

Radith

vila dines said...

i've created my layout using the old way of html-ing instead of using the upgraded template. how do i make a link to my previous entry?

pocket said...

Radith,

first, create CSS style for your new columns:

#left-sidebar{
float:left;
width:140px
}

#right-sidebar{
float:right;
width:140px
}

..adjust the width until it looks all right..

Next is to add a div containers inside the main sidebar-wrapper:

<div id='sidebar-wrapper'>
<b:section class='sidebar' id='sidebar' preferred='yes'>
</b:section>

<div id='left-sidebar'>
<b:section class='sidebar-left' id='sidebar-left' preferred='yes'>
</b:section>
</div>

<div id='right-sidebar'>
<b:section class='sidebar-right' id='sidebar-right' preferred='yes'/>
</div>


</div>

...added code is in italics...

pocket said...

Vila,

I'm so sorry, I don't have any experience with classic templates...If you plan to convert your template to .xml (new Blogger), I'll help you...Ok?

Radith Prawira said...

oo..ic2 so i 'just' have to add some new css code.. just like when we tried to make 3 column minima?( i was tring to make a 3 column before ) tq very much pocket for your explanation.. i'll try it asap.. as soon as that bx-error disappear from my life, hehehe

--

Keep posting, God Bless ^_^

Radith

Purple and Paisley said...

pocket, when i do this, i get separate widget boxes like i am supposed to, but they have extra lines in them along the bottom...what am i doing wrong?

pocket said...

Hey niteyshift...

Extra lines? Maybe the style's are interfering? When you apply the style to the widgets, do you delete it from the sidebar-wrapper? I'd have to see the code (when it's done) to know exactly...

Jan said...

Hi Pocket! This is a great tweek, thank you.

Any idea why after applying it to the sidebar, I now have a double border around the main wrapper? You can see it here http://bigbrowndogdayz.blogspot.com/

Thanks, Jan

pocket said...

Jan,

..in LAYOUT ► EDIT HTML ► find this part:

.sidebar .widget, .main .widget {
background:#000000;
border:2px solid #681f10;
margin:0 0 1.5em;
padding:5px 7px 5px 7px;
}

...you have to split those two widgets (read the tut carefully), so they'll look like this:

.sidebar .widget {
background:#000000;
border:2px solid #681f10;
margin:0 0 1.5em;
padding:5px 7px 5px 7px;
}

.main .widget {
margin:0 0 1.5em;
padding:5px 7px 5px 7px;
}

Ok?

Jan said...

Thanks! That was what I missed. Great tutorials, I've learned so much from you.

Jan

Nati said...

Hi! Have a bi of a problem.. I've put my sidebar widgets in separate boxes, but my archive is outside the box.. you can see it on
http://natiibuenosaires.blogspot.com

What have i done wrong??

Documents said...

Hi,

I have come to the point, but it would be great help if you could do me favour on how to add widgets--my own separate ones. I tried to copy the customs widget in the layout but I couldn't.

Thanks,

pocket said...

Nati,
seems all right now. Scream if you still need help..

Documents,
I don't quite follow...You can add your own widgets through LAYOUT ► PAGE ELEMENTS ► Add a Gadget and choose HTML/Javascript...Place your code there...

caya!.. said...

i want to separate the content and the sidebar only..

how can i do it?
i want it like i can see the background between the sidebar and the content..
but i dont want to change it to any color..
help me please..tq..

pocket said...

caya!..

..well, not that easy. But you can start with this: LAYOUT ► EDIT HTML ► remove the background line from the following part:

#outer-wrapper {
background:#ffffff;

...now, you'll have to apply the same background to your sidebar and post section:

#main-wrapper {
background:#ffffff;

..and:

#sidebar-wrapper {
background:#ffffff;

..now, I don't know by heart how will this look like, but do try it...

Anonymous said...

Hey, i want to install 2 widgets side by side in the header. Can you help please?

Michael

Swashata said...

Hello Pocket! :) Thanks a lot for this tut! btw just for caya we can set a background for the Outer wrapper and set the values of the backgrounds of others as transparent! like


#outer-wrapper {
background:#ffffff;

#main-wrapper {
background:#transparent;

#sidebar-wrapper {
background:#transparent;

Swashata said...

Oops it will be

background: transparent; not #transparent :)

Beth said...

I would like the background of my sidebar to be the background of my site (white with small gray dots), and I figured out how to do that, but now what I want to know is how to make a solid white background appear behind the individual boxes (so you can actually read them). How would I go about that?

Another question is this: the first widget on my sidebar says "Bethawho" and gives my location, etc -- but when I made the sidebar background dotted I found out that that widget isn't separated in a box like the others. (It's a two-column sidebar layout but that is one centered box over the two columns, if that makes sense.)

I am probably not explaining myself well... but I thought I'd throw that out there in case you understand/can help. :)

Swashata said...

Hey beth I think I can help you.. I saw your blog and edited it live using Firebug! I think you can change the code! Find .sidebar .widget on your template in edit html mode and replace its style with these.sidebar .widget {
background:#FFFFFF none repeat scroll 0 0;
border:2px inset #99FFFF;
margin:10px 0;
padding:5px 7px;
}
The result looked ok ok type [but not best] to me! Play with the code to make it more perfect!
You can visit my http://greentechspot.blogspot.com to see how I have made those changes using this tutorial

Swashata said...

Shit! Again made a mistake! Blogger should give a chance to edit our comments! Anyways replace it with these pieces of codes

.sidebar .widget {
background:#FFFFFF none repeat scroll 0 0;
border:2px inset #99FFFF;
margin:10px 0;
padding:5px 7px;
}
I hope pocket wont mind for my unnecessary long comments :)

Beth said...

Swashata,

That is a step in the right direction -- thank you!! Now I would like for the sidebar(s) to be separated from the main blog section. That way the main blog section has a dark gray background and the sidebars are have the white spotty background (but keep your individual white boxes in order to be readable). Does that make sense?? It seems like I'm so close, yet so far....

Momiji Daidouji said...

Hello! :)
I simply LOVE your blog! Your tips are SO helpful! ;) I have only one complain though... I don't know why but my blog wasn't accepting the HTML codes for this tutorial, on how to make the borders for the sidebar.. But I am sure it's not your fault! XD Oh and I have a question! On your tutorial about the embedded comments, I made it just like you showed but I can't get to have my comments (I am the owner) in one color and the other people in another color... :( I'd be SO grateful if there was a solution. If not well, I am fairly happy with the result. :) THANK YOU FOR YOUR TUTS! They're awesome! Keep up! (^_~)b Visit my blog: http://omake-tkotv.blogspot.com/. If you're interested, I'd love to make partnership, exchanging buttons or links or so. The blog is just starting but I am a part-time, self-taught designer who likes to learn and share! ;)

FANTA said...

http://the-refugee-camp.blogspot.com/

I just want you to explain me why my sidebar is like that.
I want that my "main-wrapper" is more in the left of my blog
Sorry i'm french and my english is bad.
Thank you to answer =)

Kimberly said...

I am trying to add an extra sidebar that should give me a 400 px gadget at the top of the sidebar, and then two sidebar columns underneath at 180 each. The 400 px gadget is sitting over only one of the sidebars, when I want it on top of both...does that make sense? I have the sidebar float as top but it is only on top of the middle column. Ugh!! Can you guide me? This is a blog for someone else and I don't want them to think I am stupid!! HAHA

Ciel said...

Love your blog. Any ideas on how to do this on rounders template? I´ve trying to but the code is so different. Thank you.

NicCage The Actor said...

thanks alot! You really helped our blog. Keep up the good work.

Cath J said...

Thank you for the tips.. :-D

Laina said...

Hey, is there a way to make it so that just the sidebar is seperated into boxes and not the posts?

Laina said...

Oh!! Never mind, I'm an idiot, ignore me.

NaqeebLukhman said...

to pocket, im so grateful that ive found you...
i always refere to you blog when i have problem..

Kal's Studio said...

thank you.. everyday I visit your site 4 my reference..

98David76 said...

Very Helpful thanx!

98David76 said...

I bookmarked you!

98David76 said...

Really it worked yah thank you VERY VERY MUCH!

Yasmin said...

hi...
I was wondering if you know how to add another sidebar box without splitting the other ones into pieces.
Currently, in my template, there are two sidebar boxes (I use a customized Rounders 4) and I want to know how to make 3 or more (if it is possible).
I have explained what I am trying to do better on my blog, so you can see what I mean there: fweeandplums.blogspot.com

Anton Pandia said...

Hi...
sorry bothering you with this..
I have tried all the tips in detail, but it doesnt work in my template.
i use this template:
http://another-black-template.blogspot.com/

Please need your help, what code should i put and where..?
Thanks

Ravi Kiran Muvvala said...

i faced a problem with it.actually there is no errors,but looking of sibar BORDER looks not perfectly and i don't know why two sides of box wasn't show border color?
check the blog, http://i4message.blogspot.com
Please help,

Stephanie said...

Hi, thanks for all the help- your tweaks are awesome! I was wondering if there's any way to move the sidebar OUTSIDE of the main wrapper- I'm using the son of moto template?

Any advice is greatly appreciated.

Project Management Templates said...

Thanks for the post. bookmarked

Jenny said...

I was wondering if there was a way to make different backgrounds for different widgets - minima template?

SekhetDSupreme said...

Pocket,
I am screaming!!!!! I am having the exact same problem Ravi Kiran Muvvala had. My sidebar is missing lines to make a full box
you can see what I am talking about here in my blog without content:
http://myvanity-mirror.blogspot.com/

Please help!!!!!

Anonymous said...

Hey,

I find the information you provide here really useful as it is very easy to be understood. Would you please enlighten me on how to create rounded corners that works in IE? I would really appreciate it because rounded corners are very beautiful! :D

THANKS..!

My Life and My Loves said...

this blog has been so helpful. i'm in the middle of a complete overhaul. http://mylifeandmyloves.blogspot.com/

for my main body i blocked each entry off as you taught and i love the look. i'm trying to replicate the same look for my widgets on the right and thought i was following along correctly - but i'm not getting a box - just a top line and bottom line.

also - it's seems that the widgets of 'lists' put a black line that i'd like to get rid of as well.

so new at this. hope you can help.

mpieters1@yahoo.com

Kailia Sage said...

I don;t seem to have this:

background:#ADD8E6;
border: 1px solid #E9967A;

in my html...any suggestions to how I can do this process?

MOHIT said...

I want to add a gadget button from the right sidebar.
How can I do it?

yayanakhyar said...

i want to put a Blog archive in a Box in my sidebar, how can i do it ???

Shazleen Natasya said...

Sorry , i dont understand so much .
can u explain again with simple word =)

MRV said...

THANK U!

Rocky said...

Nice tweak.

Louis Vuitton handbags said...

Louis Vuitton handbags sale and cheap replica louis vuitton handbags sale and cheap Louis Vuitton bags sale and cheap Louis Vuitton purses sale and cheap louis vuitton wallets sale and cheap lv Bags sale and cheap replica LV handbags sale and cheap cheap louis vuitton handbags sale and cheap discount louis vuitton handbags sale and cheap louis vuitton handbags on sale sale and cheap cheap louis vuitton bags sale and cheap replica louis vuitton bags sale and cheap cheap louis vuitton purses sale and cheap replica Louis Vuitton purses sale and cheap cheap louis vuitton wallets sale and cheap replica louis vuitton wallets sale

Say it...

Related Posts with Thumbnails