Three Column Blogger: Adjusting Margins For Three Column Denim Templates

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




12 Comments:

Blogger upstateLisa said...

Okay done! and working well! but now my header/banner is all screwed up! what did I or do i do?

September 16, 2008 5:50 AM  
Blogger REIT Wrecks said...

I looked at your blog and didn't see any problem. In fact, it looks great. One thing you may want to "tune up" is the "max width" in the */Header section. If you use any kind of image or logo or picture in the header (and you do), go into to */Header section and delete the section in the "header description" that says "max-width:700px;" When you increase the width of the header to 940, the max width entry will cause some imgages to be off center. It's safe to just get rid of it. This is an issue especially in Firefox.

Good luck and thanks for reading. Nice blog! If this was helpful, it would be great if you could mention this post on your blog in an article or a link. Thanks!

September 16, 2008 12:46 PM  
Blogger matte said...

hi! Struggling with my page. Can you help me, please? When i add images in my sidebars, they acquire different dimension (bigger on the left, smaller on the right one). I do: add image, then when it says "shrink to fit", i get two different pixel values for the two sidebars i have (210, and 150), so that images results in different size, while i want to have them equal on both sidebars. I tried following your instruction, but i got stuck 'cause it seems in my html i dont have the "left-sidebar-wrapper"…weird. I belive I have a minima templte, 3 columns.
What I would like would be to expand a bit both lateral bars, keeping their size equal.
I hope you can give me some hints.
Thanks so much!! Matteo.

October 19, 2008 10:56 AM  
Blogger RW said...

Hi matteo, I saw a similar question in a comment on another post and answered it there so I'm assuming you now have it figured out. If not, in your case, I would first adjust the image in photoshop to the dimensions you want and then upload it. You are using a third party mod of a blogger template, so that could be part of the problem. Try it in photoshop first and that should help. Good luck!

November 8, 2008 6:52 AM  
Blogger CyberCrone said...

I've been searching for days, trying to find a 3 column template for my blog. After reading your comments on why using 3rd party templates is not a good idea, I'm going to follow your instructions--I want to learn how to code this stuff anyway. I have a question before I even start. In designing my Web pages, I like to use percent of display area and main column width to adjust for different screen sizes and have had good success with that. But I don't see this technique used on any blog templates and it's not mentioned in your instructions. That has to be because it doesn't work well (or at all) for blogs, but I'm wondering why. Is this something you can explain to me?

February 4, 2009 6:31 AM  
Blogger RW said...

It's called fluid blog design (vs. fixed, which is what I have here) Fluid is actually better, in my opinion, and works well. It is easy to implement also, you just use percentages instead of pixels, as in the left sidebar is 20% wide, the main page is 50% wide, and the right sidebar is 20% wide, and there are 10% in margins between the three columns and the edge of the page (all adds up to 100%). I am going to do a post on it, it's very easy to do.

Thanks for the question!

February 11, 2009 9:33 PM  
Blogger Drew said...

Love your page! And I've linked to it on my blog!

It would seem to me, that this margin adjusting technique would be virtually the same on most other templates( say, a minima)

Am I correct?

I also want to know, how do I rename the side bar's to put them both to one side (in my case, the right side)?

February 12, 2009 2:55 PM  
Blogger RW said...

Drew, yes, that is the beauty of learning how to do this - you can make your blog look however you want it to look without having to pay some geek (with all due respect to my coding friends) to do it for you. If you want to move your columns from left to right or vice versa, just change the float.

June 17, 2009 8:28 PM  
Blogger Mandie said...

Thank you!!

July 20, 2009 8:36 PM  
Anonymous Anonymous said...

Changing to 3 columns was easy (thank you!!!) but changing the margins isn't working. I followed the instructions but got this error message when I tried to save the template--

Invalid variable declaration in page skin: Variable is used but not defined. Input: startside

What should I do?

August 4, 2009 8:57 AM  
Blogger Audrey Welborn said...

Two Questions: (1) I want to change to 3 column Denim. What happens to content of existing blog when you switch to 3 column. How does the information fill back in. (2) When you are changing from 2 - 3 columns, what does someone accessing your site see?

September 29, 2009 7:27 PM  
Blogger Nickie said...

help! i uploaded a new background but my sidebar pictures are tiny. How can i adjust teh width of those pictures? www.cincywhitehousenews.blogspot.com

February 5, 2010 12:52 PM  

Post a Comment

<< Home