4

I have a page with several uppercase strings that I want to transform in capatalized strings. I need to capitalize the first letter of each word.

If I use:

text-transform: lowercase;
text-transform: capitalize;

This doesn't work because only the second rule is applied. Is there any workaround for this? I prefer not to use JS.

Harry
  • 87,580
  • 25
  • 202
  • 214
user3174311
  • 1,714
  • 5
  • 28
  • 66
  • 1
    What do you want to achieve ? All in lower case except the first letter of the first word? – laruiss Oct 01 '14 at 11:32
  • 1
    You could do that using this example: http://stackoverflow.com/a/4322335/3834042 – emmanuel Oct 01 '14 at 11:34
  • I need to uppercase the first letter of each word. thanks – user3174311 Oct 01 '14 at 11:37
  • @user3174311: I have updated the question and title based on your comment. Please feel free to roll back/edit if you feel it is incorrect. – Harry Oct 01 '14 at 11:56
  • I don't think achieving this is possible with only CSS. You may have to use JavaScript (or) convert the uppercase string to all lowercase characters at the source (if you are dynamically populating the content at server side). – Harry Oct 01 '14 at 12:02
  • Here is another question on similar lines - http://stackoverflow.com/questions/3471157/css-text-transform-capitalize-on-all-caps?rq=1 – Harry Oct 01 '14 at 12:12

1 Answers1

0

You can use the following CSS code:

p {
    text-transform: lowercase;
}
p:first-letter 
    text-transform: capitalize;
}
Florin Pop
  • 5,105
  • 3
  • 25
  • 58
  • 3
    This will capitalize only the first letter mate. I think you may have missed OP's clarification in comments. – Harry Oct 01 '14 at 11:49