Text transform changes how letters look in words. It helps make text all uppercase or lowercase easily.
Text transform (uppercase, lowercase) in Tailwind
Start learning this pattern below
Jump into concepts and practice - no test required
class="uppercase" class="lowercase" class="capitalize"
uppercase makes all letters capital.
lowercase makes all letters small.
capitalize makes first letter of each word uppercase.
<p class="uppercase">hello world</p><p class="lowercase">HELLO WORLD</p><p class="capitalize">hello world</p>This page shows three lines of text. The first line is all uppercase, the second is all lowercase, and the third has each word starting with a capital letter. Tailwind classes do the text transform automatically.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Text Transform Example</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="p-6"> <section> <h2 class="uppercase text-lg font-bold mb-2">this is uppercase text</h2> <p class="lowercase mb-2">THIS IS LOWERCASE TEXT</p> <p class="capitalize">this is capitalized text</p> </section> </body> </html>
Text transform only changes how text looks, not the actual text content.
Use semantic HTML tags like <h2> and <p> for better accessibility.
Tailwind classes make it easy to apply text transform without writing custom CSS.
Use uppercase to make text all capital letters.
Use lowercase to make text all small letters.
Use capitalize to make the first letter of each word uppercase.
Practice
uppercase do to the text?Solution
Step 1: Understand the
Theuppercaseclassuppercaseclass changes all letters in the text to capital letters.Step 2: Compare with other options
Other options describe different transformations like lowercase or capitalize, which are not whatuppercasedoes.Final Answer:
Converts all letters to capital letters -> Option DQuick Check:
uppercase = all capital letters [OK]
- Confusing uppercase with capitalize
- Thinking uppercase only affects first letter
- Mixing uppercase with lowercase
Solution
Step 1: Identify the class for lowercase
The correct Tailwind class to make all text lowercase islowercase.Step 2: Check other options
capitalizechanges first letters to uppercase,uppercasemakes all letters capital, andtext-loweris not a valid Tailwind class.Final Answer:
lowercase -> Option BQuick Check:
lowercase = all small letters [OK]
- Using 'capitalize' instead of 'lowercase'
- Trying non-existent class like 'text-lower'
- Confusing uppercase and lowercase classes
<p class="uppercase">Hello World</p>
Solution
Step 1: Understand the
The classuppercaseeffectuppercaseconverts all letters to capital letters.Step 2: Apply transformation to the text
"Hello World" becomes "HELLO WORLD" when uppercase is applied.Final Answer:
HELLO WORLD -> Option AQuick Check:
uppercase transforms text to all caps [OK]
- Assuming only first letter changes
- Ignoring class effect and reading original text
- Mixing uppercase with capitalize
class="lowercasee". What happens?Solution
Step 1: Check class spelling
The classlowercaseeis misspelled and not recognized by Tailwind CSS.Step 2: Effect of unknown class
Since the class is invalid, no CSS transformation applies, so text stays as originally typed.Final Answer:
Text stays unchanged -> Option AQuick Check:
Invalid class means no style change [OK]
- Expecting lowercase effect with wrong class
- Thinking browser throws error for bad class
- Confusing class names with similar spelling
Solution
Step 1: Understand the
Thecapitalizeclasscapitalizeclass makes the first letter of each word uppercase and the rest lowercase.Step 2: Compare with other classes
uppercasemakes all letters capital,lowercasemakes all letters small, andtext-transformis not a valid Tailwind class.Final Answer:
capitalize -> Option CQuick Check:
capitalize = first letter uppercase each word [OK]
- Using uppercase instead of capitalize
- Trying non-existent class 'text-transform'
- Confusing capitalize with lowercase
