Thursday, February 26, 2009

3 Column Templates : Rounders 3 : Left and Right Sidebars

Article Series: 3 Column Templates Step by Step Guides

The Rounder 3 template that comes by default with Blogger has only two columns. However, in the blogosphere, there is tremendous demand for three column templates. If you are one of such bloggers, this tutorial will give you the steps to modify a default 2 column Rounders 3 template in to three columns with left and right sidebars.

(For the more curious readers, the article series Three Column Templates Explained covers the behind the scene details.)

This guide is specific for Rounder 3. For other Rounders templates, check the article series home. Also note that this guide will only work for a new sidebar of 240 pixels wide. This is due to the required background images provided in this tutorial are being set to that size. If you need specific conversions, please contact me.

1) Define a new CSS id selector for the second sidebar.

  • Switch to Layout -> Edit HTML
  • Find the #sidebar-wrap selector
  • Copy that full section and paste below the existing sidebar section (it doesn't have to below) and rename it to #left-sidebar-wrap
  • Change the float to $startSide of the #left-sidebar-wrap selector (See the code snippet below)
#sidebar-wrap {
width:240px;
float:$endSide;
margin:15px 0 0;
font-size:97%;
line-height:1.5em;
word-wrap: break-word; /* fix for long ... IE */
overflow: hidden; /* fix for ... float */
}

#left-sidebar-wrap {
width:240px;
float:$startSide;
margin:15px 0 0;
font-size:97%;
line-height:1.5em;
word-wrap: break-word; /* fix for long ... IE */
overflow: hidden; /* fix for long non-text ... float */
}

2) Add a new div element, which will be the placeholder for the second sidebar
  • Locate the <div id='main-wrap1'> element.
  • Copy the code shown in red, above that section (this has to be above)

<div id='crosscol-wrapper' style='text-align:center'>
<b:section class='crosscol' id='crosscol' showaddelement='no'/>
</div>

<div id='left-sidebar-wrap'>

<div id='sidebartop-wrap'><div id='sidebartop-wrap2'>
<b:section class='sidebar' id='left-sidebartop'>
</b:section>
</div></div>

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

</div>

<div id='main-wrap1'><div id='main-wrap2'>
<b:section class='main' id='main' showaddelement='no'>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>
</b:section>
</div></div>

3) Expand the width of the parent wrappers to accommodate the newly added sidebar
  • Find the CSS section called #outer-wrapper
  • Modify its width property to 980 pixels
#outer-wrapper {
width: 980px;
...
}

4) Adjustment the required margins, padding etc
  • Locate the #left-sidebar-wrap section
  • Insert a right margin of 7 pixels. Don't remove the existing 15px. This padding is in addition to that.
#left-sidebar-wrap {
width:240px;
float:$startSide;
margin:15px 7px 0 0;
...
}

5) Add the required CSS selectors for the new sidebar.
  • Locate the #sidebar h2 selector
  • Copy the code shown below, after that selector.
#sidebar h2 {
color: #aabbcc;
border-bottom: 1px dotted #aabbcc;
}

#left-sidebartop h2 {
line-height:1.5em;
color:#ffffff;
border-bottom: 1px dotted #ffffff;
font: normal bold 100% 'Trebuchet MS',Verdana,Arial,Sans-serif;
margin-bottom: 0.5em;
}

#left-sidebartop a {
color: #ffffff;
}

#left-sidebartop a:hover {
color: #ffffff;
}

#left-sidebartop a:visited {
color: #ffffff;
}

#left-sidebar a {
color: #99ddbb;
}

#left-sidebar a:hover,
#left-sidebar a:visited {
color: #ffffff;
}

#left-sidebar h2 {
color: #aabbcc;
border-bottom: 1px dotted #aabbcc;
}

/* Footer
----------------------------------------------- */
#footer-wrap1 {
clear:both;
margin:0 0 10px;
padding:15px 0 0;
}

6) Replace the existing background images with the expanded one as shown below.
All the Rounders templates use images for the rounded header and footer. We need to expand these images to accommodate the new sidebar.
  • Add a template variable to define the image host location as explained here. (This step will open up in a separate window. Return to the next bullet point after that)
  • Locate the following CSS selectors.
  • Replace the URLs of the images with the ones shown in red below.
#header-wrapper {
background: url("$imageHost/rounders3_corners_cap_top_w.gif") no-repeat $startSide top;
...
}

#header {
background:url("$imageHost/rounders3_corners_cap_bot_w.gif") no-repeat $startSide bottom;
...
}

#footer-wrap2 {
background:$titleBgColor url("$imageHost/rounders3_corners_cap_top_w.gif") no-repeat $startSide top;
color:$titleTextColor;
}

#footer {
background:url("$imageHost/rounders3_corners_cap_bot_w.gif") no-repeat $startSide bottom;
padding:8px 15px;
}

7) Modify the CSS rules for the wire frame layouts editor.
  • Locate the section that starts with "/** Page structure tweaks for layout editor wireframe */"
  • Replace that entire section with the following code.
/** Page structure tweaks for layout editor wireframe */

body#layout #header-wrapper,
body#layout #outer-wrapper,
body#layout #footer-wrap1 {
width:830px;
}

body#layout #main-wrap1 {
width: 485px;
margin-right:10px;
}

body#layout #sidebar-wrap,
body#layout #left-sidebar-wrap {
width:150px;
}


]]></b:skin>

Save the template. Switch to Page Elements view and enjoy your 3 column template! (The new sidebar might not be visible until you add some gadgets to it)

Note: You are free to use the images provided by me. But if you change your template according to this tutorial and use those images, please add the following code shown in red, right to the end of your template, in the place shown. It will simply link to this blog.

</div>

<a href="http://bguide.blogspot.com/2008/02/3-columns-step-by-step-guides.html">Three Column Modification</a> courtesy of <a href="http://bguide.blogspot.com">The Blogger Guide</a>

</body>
</html>

15 comments:

jay.osa said...

thanks for this info, but i'm having some issues with it. the 3 col worked just as it shoud, but when i go to put a pic in place of the title of the blog it does nothing. any ideas?

ids said...

@ jay.osa

The modification can't have any effect on header image. But if you keep getting the problem, drop me a mail with your blog URL. I will try to troubleshoot the problem.

Karina said...

hey what if i want three columns but the two smaller in width are on on side only instead of either side?

ids said...

@ Karina,

Here is a guide to add two sidebars on the right hand side for Rounders 3 template.

jay.osa said...

oh i figured it out, and thnaks! it looks good.

http://ttaba.blogspot.com/

Jan said...

Thank you very much for this guide! Works!

Cho said...

Thanks for this. It works, but I have a small problem.

The right column has "lines" separating bars, the left (which you provided) does not have.

Can you help me on this?

freemakeonlinemoneyblog said...

Wanted to say thanks, I am always here looking at this, works with other blogs templates with some fiddling.

Cho said...

Any response on my query?

ids said...

@ Cho,

Very sorry for the delay in responding.

If you applied step (5) correctly, the separating bars should appear. Please double check. If you still can't get it email me with the blog URL.

Chiew said...

Thanks very much for these instructions. I'd actually emailed you already, but I'll post it here, too. I'm having some issues - my right column doesn't appear on the right, but below the posts! Where have I gone wrong?
Also, my header as it is looks rather awful. Could I not remove the background header box? Or at least to centre the header within it.
My blog: http://acliltoclimb.blogspot.com

CHiew said...

I've managed to remove the background header box, but I'm still looking at the columns problem.
http://acliltoclimb.blogspot.com

Chiew said...

OK, sus'd it at last! I knew it had to do with width of some sort, so I toyed around and finally increased the width of 740px to 980px. Seems to be just about right. Tested it on a few screens and looked fine.

John the Blogging Barbarian said...

Your How-To article was very helpful ad my page is working just great, Thanks

Jessica said...

Hi!! I think this is great, but I got the message "Invalid variable declaration in page skin: Variable is used but not defined. Input: imageHost" when I tried to save. What did I do wrong?
Thanks!

Post a Comment

Thanks in advance for all your comments and suggestions. They are very much appreciated.

IMPORTANT:
If you have a specific technical question, please email me with a description of the problem and the blog's URL.