Grow your CSS skills. Land your dream job.

Auto style for first sentence of post

  • # July 27, 2009 at 11:53 am

    I know there’s CSS for the first letter of a post (magazine style, etc.), but wasn’t there also a way to make (for example) the first sentence bold, or a different colour?

    I’m going to Google it myself, I’d just said I’d post it here should anyone else have the same idea… If I find anything I’ll post.

    # July 27, 2009 at 12:01 pm

    Heh – first result on Google brought up another forum where the response to a user was:

    Quote:
    You have two choices; you can either add an element around the first sentance using either Javascript or a server side language when used in conjunction with regex. Then the element that’s been created can by styled with CSS.

    Fair enough. If I don’t want to use spans I have to use Javascript. Any idea’s there?

    @admin – move to Javascript forum if you want.

    # July 27, 2009 at 12:41 pm

    You can do the first letter or the first line, but yeah, actually finding the full stop (period) where the first sentence ends is beyond the scope of css. http://www.w3schools.com/CSS/CSS_pseudo_elements.asp

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".