CSS TEXT STYLING

Ashish Pandey

Total Post:128

Points:898
Posted by  Ashish Pandey
 1421  View(s)
Ratings:
Rate this:
Hi !

Is there a way to style the first word in tag differently than the other words in that tag? For example, say I had this snippet of code: 

<h4>Worpress Quick Tip Of The Week</h4> 

Is there way I could style the word "Wordpress" differently than the other words using css? I know I could just put a span with a unique class around the word Wordpress, but is it possible without doing that? 

Thanks

  1. shreesh chandra shukla

    Post:105

    Points:735
    Re: CSS text styling

    Hi!

    There is no :first-word selector unfortunately. You can take a look at this script though that implements it by adding the firstWord class to, well, the first word.

    span.firstWord {

      font-weight:bold;

      text-decoration: underline;

     }


     

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!