We need to use the CSS text-transform property to convert the entire content of an HTML element to capital letters or lowercase and to start each word in the text with a capital letter. Text-transform property is used to specify the text case to be apply. In the text-transform property, we can assign three values uppercase, lowercase, and capitalize. Let’s see the three types of values in a text-transform property.
Code:
Output:
To capitalize each first word in your HTML text, you need to use the CSS “text-transform” property and give it a value as “capitalize”. The first text of your heading or title should be in caps, so if you put it in small letters you can use this method to quickly change the first text of your heading to caps. The “capitalize” value is don’t affect characters that are already in uppercase they don’t transform them to lowercase. Even given a single letter “A” it is assume to be an initial letter and becomes a capital letter.
If you want to capitalize every first letter in the H1 element, use the CSS element selector and set the text-transform property to capitalize. If you want to capitalize every first letter in a specific element, give the same class name only to the specific element and use the text-transform property to capitalize using the CSS class selector.