CSS
🎯 CSS text-transform Property (Text Case Conversion)
The text-transform property in CSS is used to change the case of text automatically.
It allows you to convert text into uppercase, lowercase, or capitalized format without modifying the original HTML content.
This is especially useful for headings, buttons, menus, and UI consistency.
💬 What is it used for?
The text-transform property helps maintain consistent typography across a website.
Instead of editing text manually, CSS handles the formatting automatically.
🔹 Basic Usage
text-transform: uppercase;
➡️ This converts all letters into uppercase format.
🧩 Examples
1. none (No transformation)
<p style="text-transform: none;">
Hello World!
</p>
➡️ Text remains unchanged.
2. capitalize
<p style="text-transform: capitalize;">
hello world from css
</p>
➡️ Each word starts with a capital letter.
3. uppercase
<p style="text-transform: uppercase;">
css text transform
</p>
➡️ Converts all text to uppercase letters.
4. lowercase
<p style="text-transform: lowercase;">
HELLO CSS WORLD
</p>
➡️ Converts all text to lowercase letters.
5. initial
<p style="text-transform: initial;">
HeLLo WorLD
</p>
➡️ Resets to default browser behavior.
6. inherit
<div style="text-transform: uppercase;">
<p style="text-transform: inherit;">hello world</p>
</div>
➡️ The paragraph inherits uppercase styling from its parent.
💡 Quick Summary Table
| Value | Description |
|---|---|
| none | No transformation applied |
| capitalize | First letter of each word is uppercase |
| uppercase | All letters become uppercase |
| lowercase | All letters become lowercase |
| initial | Resets to default value |
| inherit | Inherits value from parent |
-
🧠 Summary
- The text-transform property controls the capitalization style of text.
- It helps maintain consistent UI design without editing HTML content manually.
- Most used values:
- uppercase → ALL CAPS
- lowercase → all small letters
- capitalize → First Letter Capitalized
- This property is widely used in modern UI/UX design systems.
