We often see capitalization of the first word in English newspapers, so how to set the capitalization of the first letter of a word? Many people may encounter this problem and don’t know how to operate it. Let’s explain the css How to set English initial letters to be capitalized?
To realize the capitalization of English initial letters, you can use div css. A text-transform attribute in div css can set the upper and lower case of letters, as well as the full text of letters in upper case and the full text of letters in lower case.
1: text-transform structure syntax:
The text-transform attribute has three attributes, namely Capitalize, Uppercase and Lowercase.
Capitalize means that no matter whether the letters are uppercase or lowercase, all letters will be converted to first letter capitalization. Syntax: div{text-transform:capitalize};
Uppercase means no matter whether the letters are uppercase or lowercase, all letters will be capitalized. Convert all letters to uppercase, syntax: div{text-transform:uppercase};
Lowercase means that no matter whether the letters are uppercase or lowercase, all letters are converted to all lowercase by CSS, syntax: div{text-transform:lowercase }
2: The code example is as follows:
<!DOCTYPE html> <html> <head> <style type="text/css"> h1{text-transform:capitalize} h2{text-transform:uppercase} h3{text-transform:lowercase} </style> </head> <body> <h1>php.cn</h1> <h2>php.cn</h2> <h3>php.cn</h3> </body> </html>
The display effect is as follows:
## Regardless of letters Whether it is uppercase or lowercase, we can use the text-transform style attribute to set it. The above is a complete introduction to how to set English initial letters in css. If you want to know more aboutCSS3Tutorial, please pay attention to php Chinese website.
The above is the detailed content of How to capitalize English first letters in css. For more information, please follow other related articles on the PHP Chinese website!