When should I use the `text-transform` property to change the casing of text vs directly modifying the text within the HTML document itself?


#1

Question

When should I use the text-transform property to change the casing of text vs directly modifying the text within the HTML document itself?

Answer

As web developers, we want to separate or concerns. In this context, that means keeping our structure and content separate from our styling as much as possible. As casing relates more to presentation than it does to structure, it is best practice to follow normal casing conventions within our HTML document. If we want to deviate from normal, grammatical conventions, we should use the text-transform property within a stylesheet.

Using the text-transform property can also be more time efficient if we are changing the casing retroactively because it allows us to target groups of text rather than manually modifying each character within the HTML.