Capitalizing text can also be done by CSS by using the text-transform property. The text-transform property is used to change the case and ‘capitalize’ value is usually used for titles and headlines. The text-transform property takes following values
Value |
Description |
None |
No capitalization. The text renders as it is. |
capitalize |
Transforms the first character of each word to uppercase |
uppercase |
Transforms all characters to uppercase |
lowercase |
Transforms all characters to lowercase |
The text-transform property has the value of ‘none’ as the default value for all the elements on a web page. They are used as
text-transform: uppercase;
This property is inherited so a tag that’s nested inside a tag with text-transform property applied to it gets the same case.