« more about how Al-Muhajabah's Islamic Blogs is set up | Main | show/hide sidebar blocks »

differentiating posts by category using CSS

To make it easier to tell what you're looking at, I've done a sort of "color-coding" for each of my categories at Al-Muhajabah's Islamic Blogs. A Quranic Journal has a yellow background, The Clipboard has a blue background, and veiled4allah has a pink background. There are two ways that this could be done. One is to set up a separate stylesheet for each category. I could then hard-code it into the index pages that I've made for each category and then call it on the category archive pages with something like:

<link rel="stylesheet" type="text/css" href="<$MTBlogURL$><$MTArchiveCategory dirify="1"$>.css">

and on the individual entry pages (and also the comments and trackback pop-ups) with something like:

<link rel="stylesheet" type="text/css" href="<$MTBlogURL$><$MTEntryCategory dirify="1"$>.css">

The other method is to define a class for each category in the existing stylesheet and then modify the elements on the page to include the category name in their CSS class. Again, the index pages have the category hard-coded and the archive pages (and comment and trackback pop-ups) have the appropriate category fed in with the MTArchiveCategory and MTEntryCategory tags.

Although the first method is easier, I actually did it according to the second method. Go figure.

This is one of several tricks that you can use to give your pages from different categories a slightly different appearance. The same basic technique of using dirified category names (A Quranic Journal becomes a_quranic_journal, The Clipboard becomes the_clipboard and veiled4allah remains veiled4allah) can also be used to assign different image files for the categories. There's also the TopIcon plugin, which I'm using and will discuss in a later post, inshallah.

About This Blog

  • Disclaimer: This is a personal site and is not connected with Six Apart, Ltd, the makers of Movable Type
  • Contact me:
  • Readme: What this blog is and is not
  • Reference: Templates for Al-Muhajabah's Islamic Blogs

August 2008

Sun Mon Tue Wed Thu Fri Sat
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            

Tips by Type

Tips by Area

Other ways to read this blog

Feed Subscribe to this blog's feed
(default is RSS 2.0, I also have RSS 1.0 and Atom)

Text-only version
Powered by
Movable Type 3.2