π Introduction
The text-transform property in CSS controls the capitalization of text. It allows you to convert text to uppercase, lowercase, or capitalize the first letter of each word β all without modifying the actual HTML content. This makes it a powerful tool for headings, buttons, UI labels, and consistent typography. β¨
π― Why Use text-transform?
- To enforce consistent text formatting without changing content π‘
- To style navigation menus, buttons, or labels elegantly π¨
- To automatically capitalize headings and titles βοΈ
- To convert case dynamically for multilingual UI π
π§ Available Values
1. none
No transformation is applied (default behavior).
2. uppercase π
Converts all letters to uppercase.
3. lowercase π‘
Converts all letters to lowercase.
4. capitalize β¨
Capitalizes the first letter of each word.
5. full-width π§±
Converts characters to their βfull-widthβ Unicode versions β often used in East Asian typography.
6. full-size-kana π―π΅
Converts Japanese katakana characters to full-width size. (Useful for Japanese UI/typography.)
β¨ Syntax
Basic Syntax
selector {
text-transform: none | uppercase | lowercase | capitalize | full-width | full-size-kana;
}π₯ Examples
1. Uppercase Headings
Uppercase
h1 {
text-transform: uppercase;
}2. Capitalizing Titles
Capitalize
.title {
text-transform: capitalize;
}3. Lowercase Text
Lowercase
p.note {
text-transform: lowercase;
}4. Japanese Full-Size Kana
full-size-kana
.jp-text {
text-transform: full-size-kana;
}π Comparison Table
| Value | Effect |
|---|---|
| none | No transformation |
| uppercase | Converts all text to UPPERCASE |
| lowercase | Converts all text to lowercase |
| capitalize | Makes First Letter Of Each Word Uppercase |
| full-width | Expands characters to full-width Unicode |
| full-size-kana | Converts Japanese katakana to full-width |
πΌοΈ Visual Example
Further details can be found at: https://dummyimage.com/800x230/eeeeee/000000&text=uppercase+|+lowercase+|+capitalize
π Conclusion
The text-transform property is a simple yet powerful CSS tool that ensures consistent, aesthetic, and accessible text formatting across your UI. From uppercase buttons to capitalized headings, it gives you full control without touching the original content. Master it and elevate your typography game! π