开发者

change First letter of word font size with javascript/jquery

Is there a way to select the first letter of each word with either javascript or jQuery?

Im trying to make tags on my page have the first letter of each word be a big开发者_如何学JAVAger font size. Im assuming it involves regular expressions but all i keep finding are things for form validation. I also see a bunch of stuff for capitalizing the first word. I'm trying to change the font size.

Does anyone know if this can be done and how? Thanks.


If you are just looking for a styling change, you might be able to get away with pure CSS using :first-letter.

Here's an example: http://jsfiddle.net/bgNP3/1/

Note: I apparently had to make the spans into inline-blocks for the effect to work.

Update fixed link to jsfiddle.


You could try using:

  • letteringjs its may be a little more complex than what you need tho, or
  • you could use this Is there any clean CSS method to make each letter in a word a different color?
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜