Twenty Eleven – Sidebar width explained and 2 bonus layouts

I’ve had many questions on how to change the width of the sidebar in Twenty Eleven, I’m going to show how it can be done for both left and right sidebar layouts. My last post on this was a bit confusing, I’ll try to explain it as best I can.

First lets take a look at the layout, it’s easier to understand what you’re doing when you understand the way things work.
There are 3 main sections to the layout
#primary – The area the content and sidebar reside in.
#content – Your post content.
#secondary – The sidebar.

Here’s the CSS for the default right sidebar layout.

Think of the #primary as a box, and inside there are two smaller boxes that fit perfectly. If you were to make one box bigger, the other box will have to get smaller. Here is an image that might help visualize the layout.
Twenty Eleven Layout

The content is 58.4% wide, the sidebar is 18.8% wide. There is also a 7.6% margin on the left and right of the content, and on the right side of the sidebar. Add this all up 58.4 + 18.8 + 7.6 + 7.6 + 7.6 = 100% These cannot add up to more than 100 or the sidebar and content won’t fit together within the #primary area.
Twenty Eleven Index Layout
If we increase the sidebar by 5%, we need to take 5% away from something, it could be from the #content width, or from the margins.

Ok enough explaining, take a look at the code below and compare it to the code above. I’ve increased the sidebar by 5%. I had to adjust 3 areas, the sidebar width, the content width, and the #primary margin to allow for the wider sidebar

The left sidebar layout is pretty much the same only backwards for the #primary margin. Here’s the original CSS for it.

Here it is with a 5% increase to the sidebar

You don’t have to take the width from the #content either, you can remove it from the margins instead then your content size will stay the same. If you’re using NomNom theme, you’ll need to add the extra sidebar to this, use #extra-sidebar class with the #secondary, EX: .left-sidebar #secondary, .left-sidebar #extra-sidebar {}

BONUS: Smaller Margin Layouts

Twenty Eleven theme contains alot of large margins which reduces your content area. I never cared much for this so here’s an easy way to reduce some of it by 3% on each side, and make better use of your precious content area.

The content and sidebar both have a margin of 7.6%, that’s 7.6% x 3= 22.8% of the area in your theme is wasted! The site title, search and menu div also share these same margins. So to use some of this space all I did was reduce each margin by 3%, then add the 3% back to the width of the content and sidebar, so you have 6% more content showing on your site and it still looks nice.

I’m not going to explain in detail, but you should be able to figure it out if you’ve stuck through this post.

(I’ve added NomNoms extra sidebar class in it as well)

This is for the left sidebar layout

55 thoughts on “Twenty Eleven – Sidebar width explained and 2 bonus layouts

  1. THANK YOU THANK YOU THANK YOU!! It was so hard to find this on the WordPress site. The moderators won’t stop sniping at people to use child themes or to stop “interrupting” somebody’s thread by asking the SAME question!

  2. This was very helpful–to a point. I needed to increase the sidebar size so that a Facebook like box with faces, 292 px, would fit. Now it fits, but it’s moved down much lower on the page leaving a big gap on the top left. What to do?

    This is my modified sidebar.

    Thanks, Carol

    1. Hi Carol, looks like you’ve only changed the width of the sidebar but didn’t adjust the other areas. (this is actually what the post was about)

      Take a look at this code and notice the 3 areas you need to adjust to reflect the new sidebar width. Originally the sidebar width is 18.8%, since you’re increasing that to 29.2% the difference is 10.4%. Each section needs to be adjusted to reflect that in order to make room for the wider sidebar.

      Let me know how that works out for you

      1. I guess the situation was corrected somewhat, but now the sidebar and content overlaps with the main content. I’ll try to think about this and figure it out, but I’m still confused. I am very grateful for the help! Thanks.

  3. Try this, for the content section increase the margin

    That should fix it up. If you want to bring things closer to the edges of the page, you can change the 7.6% margins to something like 3.6% as well, that will give you a bit of room, then increase the width of the sidebar by 4% and the content by 4%.

    Once you get the hang of how it works, it’s pretty easy.

    1. Thank you. It worked! I do think I understand it better now, and yes, I might try tweaking the margins some more. But it looks so much better now, and that Facebook feed is important to us. You have been a great help to this little volunteer.

  4. Thanks for the great article on sidebars and margins in Word press 2011. I’ve had a bit of a play and had success in following you examples but have been unable to achieve my goal properly.
    I’m want to increase my right hand side bar to 300px whilst trying to keep as much content area as possible and robbing the margins, which I think would mean something like :
    content width 60%
    Sidebar 30%
    Left of content 3%
    Right of content 4%
    Right of sidebar 3%

    I am still a bit confused as to what to change, as I can only grasp half of the concept.
    Sorry for being a bit dense, Is it possible to help me? Thanks

Leave a Reply - Use <pre>YOUR CODE</pre> when posting code.