WordPress.org

Ready to get started?Download WordPress

Forums

How to amke the first letter of a post bigger with different color? (5 posts)

  1. RakeshRahman
    Member
    Posted 1 year ago #

    p:first-letter
    {
    color:#ff0000;
    font-size:xx-large;
    }

    I added the code above, but it affected every first letter of all paragraphs. Please help me out.

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Try inquiring on a CSS-specific forum, as CSS queries this specific expand beyond WordPress' scope for support.

  3. Good Guy
    Member
    Posted 1 year ago #

    Your css should look something like this:

    p.special:first-line {
    	text-transform: uppercase;
    }
    
    p.special:first-letter {
    	font-size: 20pt;
    	color: red;
    }

    and your HTML would look like this:

    <p class="special">Test of my fonts;</p>

    Now only the selected paragraph will be affected by this code.

    Good luck.

  4. RakeshRahman
    Member
    Posted 1 year ago #

    You meant I have to change the HTML as well?

    Thanks for your reply

  5. Good Guy
    Member
    Posted 1 year ago #

    You meant I have to change the HTML as well?

    Yes to target specific paragraphs otherwise the generic one will change all of the p tags.

    Also, use these codes in a child theme so that you don't have to worry about automatic updates of themes in the future.

    Good luck.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.