We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New Plugin: First Letter

Development and Programming

Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio

First Letter is a quickly adapted plugin, based off of Drop Caps, to let you wrap the first letter of your weblog field to a CSS/HTML tag of your choosing.

Before: The quick brown fox jumps over a lazy dog.

{exp:weblog:entries entry_id="41"}
    {exp:firstletter tag="em" key="4" class="grand"}
    {body}
    {/exp:firstletter}
{/exp:weblog:entries}

After: <em class=”grand”>T</em>he quick brown fox jumps over a lazy dog.

Download

       
George Ornbo's avatar
George Ornbo
272 posts
17 years ago
George Ornbo's avatar George Ornbo

Just curious why you don’t just use :first-letter in a CSS file?

       
Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio
Just curious why you don’t just use :first-letter in a CSS file?

I needed a drop cap on the first letter of the body, not every paragraph… but if I add a class on the first paragraph only, then it defeats the point of the client not having to style their entry.

Do you know of a better way?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
17 years ago
Ingmar Greil's avatar Ingmar Greil

Using :first-child? Can you actually combine :first-child and :first-letter? Although I don’t see why not. That would work in a perfect world, at least, not sure if support is widespread enough yet.

EDIT: Not supported by Explorer 6 on Windows. (Too bad.) Explorer 7, Safari 3.0, iCab and Opera support it, so I have no doubt about Firefox.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.