We can use capitalize
to convert text to title-case without JavaScript.
capitalize
The paragraph is capitalized.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>TailwindCSS</title>
</head>
<body>
<p class="capitalize">sam</p>
</body>
Line 10
<p class="capitalize">sam</p>
capitalize
: convert text to title-case
Conclusion
capitalize
is a handy utility to convert text to title-case