Tweaking the CSS Code

Mar 2, 2010

(This is a sub-post for Step 5 from Tutorial 11: Starting Your Own Blogger Template)

This is the crucial part of designing - setting how your blog looks like. By this time the widths of all the containers inside the CSS code should have been set. What you need to know about tweaking the CSS code is that it's a recursive process - it's a process of refining that always repeats back and forth until you're 'happy' with the end result.

There are so many things to tweak and so many containers to customize. So how do you do this and where do you start? The easiest approach is to start from the top. Assuming that you're starting from an existing template, at this point you don't have to worry much about customizing the body, outer-wrapper, and content-wrapper, except the width. You can tweak these containers later (or let the existing code as default, unless you want to tweak them later). If you want to use an image as a background image of the whole template, you can also do this later.

Read Tutorial 3: The Structure of CSS Styling Section first if you're not familiar with the basics of the CSS Styling part of the code. Also remember that you should not expect your design to be perfect the first time you do it. It's a process that takes time. To know the basics of tweaking the CSS code, read Tutorial 4: Setting the Properties of a Container. And, if you don't know what containers to customize, read Tutorial 5: Common Containers and Elements in a Blogger Template.


Header:
I'd suggest you start with the Header section. What you commonly need to do here is to set the background color, set how the Blog Title and Blog Description looks like - the font, colors, font-size, etc. If you want to set a large background image as the header image, set it using the Edit Header button in the Page Elements page. The list below is from Tutorial 5.

  • #header-wrapper - the container that wraps your Blog Title and Blog Description.
  • #header - the container just inside the header-wrapper.
  • #header h1 - the command inside this containers controls the appearance and layout of your Blog Title.
  • #header h1 a - controls the properties of the Blog Title as a link text.
  • #header .description - the properties of your Blog Description.
  • #header a img - controls the properties of an image inside your header container.

Main and Post:
The next container to tweak is the Main and Post containers (including the Post-Footer). This one will take most of your time because there's a lot of subcontainers inside it. Infact, Post is a subcontainer of Main. It's usually easiest if you tweak the subcontainers following a certain order. My suggestion is to follow the order below. The list below is from Tutorial 5.

Main:
  • #main-wrapper - the container that wraps your Date Header, Blog Posts, Comments, Feed Link, and any widgets that you drag above or below the Blog Posts.
  • #main - the container just inside the main-wrapper.
  • #main .widget - controls the properties of all widgets inside the main container.
  • h2.date-header - sets the properties of your Date Header (just above your Post Title).
  • .post - sets the properties of your Blog Posts container.
  • .post h3 - sets the properties of your Post Title.
  • .post-body p - sets the properties of the body or content of your post.
  • .post ul - sets the properties of an unordered list (a list that is not numbered).
  • .post ol - controls the properties of an ordered list (a numbered list).
  • .post li - controls the properties of the individual list inside an unordered list or an ordered list.
  • a img - controls the general properties of an image (the a refers to a link; and an image is by itself a link).
  • blockquote - sets the quoted text in your posts.
  • code - sets the text contained within the code tags in your posts.
Post-Footer:
  • .post-footer - sets the overall properties of the post-footer container.
  • .post-footer-line - sets the properties for each new lines in the post-footer.
  • .post-footer a - sets the link text properties inside the post-footer.
  • .post-footer .post-comment-link a - sets the "comment" link inside the post-footer.
  • #blog-pager - controls the properties of the "newer posts", "home", and "older posts" links.
  • #blog-pager-newer-link - controls the properties of the "newer posts" link.
  • #blog-pager-older-link - controls the properties of the "older posts" link.
  • .feed-links - controls the "Subscribe to: Posts (Atom)" link.

Sidebars:
Once you're done with the above, customize the sidebar. If you have more than 1 sidebar, you may want to customize each sidebar differently. You'll also need to customize the Profile container and the Blog Archive if you want them to be different from other sidebar widgets. The list of container elements from Tutorial 5 are:
  • .sidebar-wrapper - the container that wraps all elements and contents in a sidebar.
  • .sidebar - the container just inside the sidebar-wrapper.
  • #sidebar1 - sets the properties inside sidebar1.
  • #sidebar2 - sets the properties inside sidebar2. If you want the properties inside sidebar1 and sidebar2 to be the same, than you can just the properties inside .sidebar and don't have to even write down the #sidebar1 and #sidebar2 in your CSS code.
  • .sidebar .widget - controls the properties of all the widgets (the Added Page Element) in your sidebar.
  • #sidebar1 .widget - only sets the widgets in sidebar1.
  • .sidebar .BlogArchive - sets the Blog Archive properties. Technically, this is a sidebar widget too, but I'm not sure why setting the properties for sidebar widgets doesn't change any properties for the Blog Archive. That's why I have to write down the .BlogArchive command to set its properties.
  • .sidebar h2 - sets the title/header properties of a sidebar widget.
  • .sidebar #BlogArchive1 h2 -sets the properties of the Blog Archive's title.
  • #Profile1 - sets the properties for the About Me block.
  • #Profile1 h2 - sets the title/header for the About Me block.
  • .profile-img a img - sets the image in the About Me block.
  • .profile-textblock - sets the author description About Me block.
  • .profile-data - sets the author's data in the About Me block.
  • .profile-datablock - sets the overall blocks of data in the About Me block.

Comments:

After the sidebars are done, customize the Comments container next. Post a few test comments to see how they will appear after tweaking. The list of container elements from Tutorial 5 are:
  • #comments - sets the overall comment container's properties.
  • #comments a - sets the link text properties inside a comment container.
  • #comments h4 - sets the header of the comment container.
  • .deleted-comment - sets the properties of the deleted comment.
  • .comment-author - sets the properties of the comment author.
  • .comment-body p - sets the comment body properties.
  • #comments ul - controls the unordered list inside a comment container.
  • #comments li - controls the individual list inside a comment container.

Footer:

The last container to be customized is the Footer. The list of container elements from Tutorial 5 are:
  • #footer-wrapper - the container that wraps all elements and contents inside a footer section.
  • #footer - the container just inside the footer-wrapper.
  • #footer h2 - sets the properties of the footer title/header.
  • #footer .widget - controls the footer widget properties.
  • .footer a - controls any footer link texts.

Refining Touch:

Now that you're done customizing all the containers, what you need to do is go back and take a look at your blog as a whole and do some minor tweakings. What I suggest here is you might want to change some font or background colors, font size, margins and paddings, adding borders or changing the borders colors, and so on. But when adding borders, be careful that it might change the width of the container that you're adding the borders on. If there are problems (say that the Sidebar is pushed below the Blog Post), you'll need to increase the width of the parent container that it's in.

The best way to change background and font colors is to have them as variables so that you can use the Fonts and Colors tab in the Layout page.

0 comments:

Post a Comment