點燈坊

失くすものさえない今が強くなるチャンスよ

Using capitalize to Convert Text to Title-case

Sam Xiao's Avatar 2022-01-24

We can use capitalize to convert text to title-case without JavaScript.

capitalize

capitalize000

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

Reference

TailwindCSS, Text Transform