Home SEO Tools FAQs Guest post Contact Donate

Add a drop cap to each post using CSS

| 16 comments
drop cap 1

A drop cap is an enlarged first (capital) letter of a paragraph. The letter is dropped several lines deep and the top of the letter is usually flush with the top of the first line of rest of the text. Drop caps are used to lead the readers eye to the start of an article or a chapter. You can find them in most magazines and newspapers.

This tutorial will show you how to turn the first letter of your Blogger posts into a simple drop cap. Once the code is added it should hopefully apply drop cap to all your existing and future posts, automatically.

We will only use a first-letter pseudo element in your template CSS. There is no need for you to edit your posts.*

*Note 1: For this to work, your text must be first thing to occur in your post. If you put an image, a div or any other HTML element at the beginning of a post, the code by itself won’t work.

Here we go:

 

I. Adding drop cap style in CSS

  1. Go to Dashboard > Design > Edit HTML.
  2. Add the following CSS code snippet right before ]]></b:skin> line in your template code  (or for Designer template,  add it into the custom CSS editor):
    .post-body:first-letter, .post-body .dropcap:first-letter {font-weight:bold;font-size:65px;float:left;padding:0;margin:-4px 5px 0px 0px;position: relative;background-color:none;line-height:0.9;}

    If you write your post using Windows Live Writer, replace the selector post-body:first-letter with .post-body p:first-child:first-letter. This is because WLW will automatically put your text in a paragraph (<p> tag).
  3. Preview.
    Make sure the drop cap aligns nicely with the rest of the text. Adjust font-size and top margin to achieve that.
  4. Save when you get it right.

 

II. Defining “dropcap” class in post HTML

Proceed with this step only if a drop cap does not appear in a post after completing step I. (It’s probably due to one of the reasons stated in Note 1.)

You need to do the following steps on every “troubled” posts:

  1. Go to Dashboard > Edit Posts to edit the post.
  2. Switch to HTML mode.
  3. Enclose the text at the beginning of your post with a span tag and give it a class, named “dropcap”, like this:
    <span class="dropcap">This is the text at the beginning of your post. Any amount of text will do.</span>
  4. Preview post before saving.

Enjoy!

16 comments to "Add a drop cap to each post using CSS"

Anup @ Hack Tutors September 7, 2010 7:20 PM    

This one is amazing trick. I have these type of letter on the newspapers and you have made this on blogspot :)

Thanks for sharing :)

Anonymous,  September 9, 2010 8:17 AM    

Could this feature be modified so that the drop cap appears only on those posts where chosen, rather than on all posts? Thanks for a fantastic blog tutorial site. Heaven for HTML beginners like me.

Greenlava September 9, 2010 1:22 PM    

@Anonymous
Remove ".post-body:first-letter" from I)2, then do step part II.

Suresh Khanal from seommotips.com September 15, 2010 10:33 PM    

It is an interesting post. You have defined and explained Drop Cap very nicely. Though I can't use it in my blog as it is not in Blogger platform, I could learn how I can modify my theme code and css file to produce the result.

Greenlava September 16, 2010 1:16 AM    

@Suresh Khanal
I hope you can adapt it to your Wordpress theme.

Swamykant from YourDigitalSpace.com September 17, 2010 5:07 PM    

Thanks for the Tips. I will try to use this in Wordpress Theme

cu734ngel October 22, 2010 7:57 PM    

uh-oh..sooo coool...thanx for the tips..:)

Greenlava October 22, 2010 8:52 PM    

@cu734ngel
You're welcome. Thanks for taking the time to comment.

Martin December 16, 2010 1:23 PM    

Hello, I've added your code in the "edit html" and add your step 2, but it doesn't work. And then, I also edit my post (the newest one) so that it begins with text rather than image, but the drop cap also doesn't work. Any suggestions? My web is www.martinmanurung.com

Thanks!

Greenlava December 16, 2010 7:52 PM    

@Martin
Your posts start with p tags. Replace your selector with this one:
.post-body p:first-child:first-letter

Liz March 12, 2011 7:59 PM    

Sheer genius! Thanks for sharing such amazing tips.

Anonymous,  November 3, 2011 7:25 PM    

GUYS! DOES ANY1 KNOW HOW TO CHANGE THE COLOUR OF THE BIG LETTER...??? I WANNA MALE MINE LIKE BLUE OR SOMETHING.

Anonymous,  November 3, 2011 7:27 PM    

NEVER MIND! I GOT IT!

Lucy Chen February 1, 2012 9:29 AM    

But I can't find ]]> in my html code...

Greenlava February 2, 2012 11:03 PM    

@Lucy Chen
Look carefully, you'll find it. Or try the search function by pressing Ctrl+F, type in ]]> in the search box and hit Enter.

Jeanie (Inspired Wish) February 20, 2012 6:32 PM    

I have tried the code and done a practise post - worked a treat. Thanks =) I'm keen to change the font, but otherwise awesome, thanks.

We love to hear from you! Leave us a comment.

To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool. Then paste the escaped code here.

If your question is unrelated to this article, please post on our Facebook page.

Pls share this page

Get this
Click to go to top Click to comment