When you’re working with CSS, there’s nothing easier than capitalizing each letter in string using the text-transform CSS property. To be fair, it’s way easier than capitalizing a string with Javascript.

Here’s how you do it:

.capitalized {
  text-transform: capitalize;

Now you can add the capitalized class to the desired HTML elements by editing the HTML file, or you can do it dynamically with JavaScript.

document.getElementById("element").className = "capitalized";