target first letter of each word in css

2020-02-13 05:21发布

问题:

I need to change size, color, and weight of every first letter of each word. I am not talking about Capitalize each first letter. I mean that target first letter and apply style according to my choice. : Click Here to see example about which i am talking.

回答1:

AFAIK to achieve this you will have to write the 1st letter in seperate tag like label or div or p tag and apply css to this tag and put rest letters in normal tag

UPDATE: As per your comment if you are getting sentence from text field you will have to make a Javascript that will loop through all words and with the help of substr find the 1st character of each word and appy css by putting it in a tag and keep rest letters outside the tag then replace final output with original text