Three Column Blogger

Tuesday, September 9, 2008

Adjusting Margins For Three Column Denim Templates

In the earlier related post, we showed you how to make a three column Denim layout. In this post, we will show you how to adjust margins and columns widths in your new three column Denim template.

One of the first things you may notice about your new three column Denim blog is that there is no margin on the left-hand side of the left sidebar. This is easy to fix, and we posted these instructions separately so you could gain confidence in adjusting margins and also column widths. This way, you can completely customize the look of your new three column layout to almost any desire completely on your own.

First, however, a word about pixels and screen width. In our three column tutorial, you widened the width of the main page from 720 pixels to 940 pixels. This was to make room for the third column. 940 is a safe width which will allow almost all users to easily view your blog pages on existing monitors (on another blog of mine, fewer than 5% of viewers use the old 800x600 screen resolution). We also used side-bar widths of 192 and a main column width of 500. In addition, there are also (4) 14px margins built in to the template, and in the three column tutorial we left those the way they were.

In this tutorial, we are going to move those margins around a little, and also explain how column widths and margins can be customized to your liking.

First, about that left-hand column margin: we should to fix it. Right now, your left sidebar code should look like this:

#left-sidebar-wrapper {
margin-$endSide: 14px;
width: 192px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 second line shows the margin settings, which call for 14 pixels on the "end side" or right hand side of the left sidebar. Since the margin settings on the main column already have 14 pixels on the left hand side, this means we now have a 28 pixel margin between the left sidebar and the main column. These doubled up margins are what makes the columns look unbalanced. Consequently, we should change the sidebar margin so that the 14 pixels are on the left-hand side, or start side, of the sidebar instead of the right side. That's easy. Just change "$endside" to "$startside", like this (remember to edit carefully; there is an "s" in $startside):

#left-sidebar-wrapper {
margin-$endSide: 14px;<-------change $endSide to $startside
width: 192px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

Hit preview, and if everything looks good, save the changes and republish. You should now have equal 14 pixel margins on the left and right hand edges of your blog, and equal 14 pixel margins in between the main column and the left and right sidebars. Everything is now balanced.

If you want to changes the widths of your columns, that's easy too, but you must keep in mind that the the column widths plus all the margins must all add up to your main page width. Right now, your main page width is 940 pixels, into which you fit one main column that is 500 pixels wide, two sidebars that are 192 pixels wide each, and fours margins that are collectively 56 pixels wide (4x14). Not coincidentally, the three columns and all the margins also add up to 940 (500+192+192+56=940).

Accordingly, you must maintain this relationship if you adjust your column widths. For example, if you want to increase the width of your two sidebars by 8 pixels each, you'll need to increase the width of your main page by 16 (2x8) pixels, such that the new main page width is 956. Conversely, you could also reduce all the margins by 4 pixels each, such that they are all 10 pixels apiece instead of 14, and the overall page width can remain at 940 pixels.

The possibilities for customization are almost endless, so long as all your columns and margins do not exceed the main page width. If they do, the right hand column will usually drop down to the bottom of the page. If you decide to increase your main page width to accommodate larger columns, be careful not to increase it too much. Anything larger than 1028 pixels will cause trouble for viewers with older monitors (which have smaller screen resolutions). They will have to scroll left and right, back and forth, to read the content of your blog, and that will reduce readability.

I hope this tutorial on adjusting your three column Denim margins was helpful. Most of all, I hope you enjoy your slick new three column Denim layout!

Labels:

Stumble Upon Toolbar Bookmark and Share




Monday, September 8, 2008

Three Column Denim

These instructions for adding a third column to Denim will have you up and running with a three column Denim template in no time at all. Adding a third column to Denim is pretty straightforward, especially if you follow these easy instructions. Denim is a popular Blogger template, and it's also pretty easy to convert into a three column layout.

These instructions are simple and easy, and you can do it if you don't know the first thing about HTML.

First, open up Blogger and go into your Dashboard, then click on the "Layout" tab. Then go into the "Edit HTML" tab. You will see a bunch of gobbledygook and gobbledygook it shall remain - you don't need to know anything about it. Just scroll down (or, allow me to introduce your browser's control F (CTRL+F) command, you can just type in /* Header and click next) until you see this:

/* Header
-----------------------------------------------

Now, change the width of the "header" from 760 to 940:

#header {
width:760px; <-------change to 940
margin: 0 auto;
background-color: $headerBgColor;
border: 1px solid $headerBgColor;
color: $headerTextColor;
padding: 0;
font: $headerFont;
}


That piece of code should now look EXACTLY like this:

#header {
width:940px;
margin: 0 auto;
background-color: $headerBgColor;
border: 1px solid $headerBgColor;
color: $headerTextColor;
padding: 0;
font: $headerFont;
}

So far so good. Next, scroll down (or use CTRL+F) to where it says:

/* Content
----------------------------------------------- */

Now, just like you did in the "header" above, change the "content-wrapper" width from 760 to 940, (2) change the "main-wrapper" width from 464 to 500, and (3) change the width of the "sidebar-wrapper" from 240 to 192:

#content-wrapper {
width: 760px; <-------change to 940
margin: 0 auto;
padding: 0 0 15px;
text-align: $startSide;
background-color: $mainBgColor;
border: 1px solid $borderColor;
border-top: 0;
}

#main-wrapper {
margin-$startSide: 14px;
width: 464px; <-------change to 500
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

#sidebar-wrapper {
margin-$endSide: 14px;
width: 240px; <-------change to 192
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

Next, take this new block of code (in red) and paste it in exactly as it appears directly in between the "content-wrapper" code and "main-wrapper" code. It's helpful to use "CTRL C" to copy, and then "CTRL V" to paste, if you didn't already know that trick. Regardless of how you do it, you must paste it in between these two code blocks, nowhere else.


#left-sidebar-wrapper {
margin-$endSide: 14px;
width: 192px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 new code block should look exactly like this:


#content-wrapper {
margin-$endSide: 14px;
width:
940px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

#left-sidebar-wrapper {
margin-$endSide: 14px;
width: 192px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

#main-wrapper {
margin-$startSide: 14px;
width:
500px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

#sidebar-wrapper {
margin-$endSide: 14px;
width:
192px;
float: $startSide;
background-color: $mainBgColor;
display: inline; /* fix for doubling margin in IE */
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 */
}

At this point, believe it or not, there is only one more step. This particular step is hard only because you need to make sure you paste the additional code in the right spot, and this next spot can be a hard place to identify (CTRL+F helps here a lot).

Anyway, scroll down (or use control F) to the " */ Footer " section, and the scroll a little further until you see:


<div id='content-wrapper'>

Then, locate the the "main wrapper" id a few lines below it. It looks like this:


<div id='main-wrapper'>

Now, just above the "main wrapper" id, paste in the following code EXACTLY as it appears:


<div id='left-sidebar-wrapper'>
<b:section class='sidebar' id='left-sidebar' preferred='yes'>
<b:widget id='Subscribe1' locked='false' title='Subscribe' type='Subscribe'/>
</b:section>
</div>

Note: this will also insert the RSS feed widget into your sidebar, but you can customize that however you'd like when you finish using the Layout tab. For now, there's no need to worry about it. So, after you do that, the newly modified section should now look like this:


<div id='content-wrapper'>

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

<div id='left-sidebar-wrapper'>
<b:section class='sidebar' id='left-sidebar' preferred='yes'>
<b:widget id='Subscribe1' locked='false' title='Subscribe' type='Subscribe'/>
</b:section>
</div>


<div id='main-wrapper'>


And you are a now master Denim coder, because you're done! Hit preview to see your new three column blogger layout, and then save the template. Go into layouts and add a google gadget, or a widget, of your choice. If you'd like to adjust your margins, go to Adjusting Margins For Three Column Denim.

Best of luck with your blogging. Links to this post are always welcome. If you would like to create a quick link in one of your posts or on your blogroll but are unsure how to do it, just insert this html string in your post text:

</a href="http://www.threecolumnblogger.com/">Three Column Blogger</a>


It will appear in your post text/blogroll as Three Column Blogger

Thanks!!

Labels: ,

Stumble Upon Toolbar Bookmark and Share