Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

emphasize first word of every paragraph in CSS

Status
Not open for further replies.

krayzie1628

Technical User
Aug 23, 2006
1
AU
Hi everyone,

I need some help. I am creating a few XHTML pages for my school and I require to make the first word of each paragraph 50% larger than the surrounding text. How do I go about doing it without going to the first word of each paragraph and use the <span> tag.
P:first-letter { font-size: 150%} is good but it only applies for a letter not the whole word.

Any suggestions??

Thanks
 
AFAIK you will need to use the span, because there's no mention in the CSS2.1 or CSS3 spec of the :first-word pseudo element.
 
You could work around it, it just depends on what your doing. CSS2 has :first-line, which might work. If your problem is that the content is user created or from a database or some-such you could use some clever javascript string handling to style the first word.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top