Keep On Hacking

Uppercase First Letter

May 04, 2020

One of the common operations with strings is to capitalize the first letter of every word especially when writing titles. Whether you use a server-side language or Javascript to pull your data, you can leverage CSS to achieve this. All you need is the text-transform property.

h1 {
  text-transform: capitalize;
}

GitHub Gist


Written by Daniel who lives and works in the beautiful city of Salem training dogs. You should follow me on Twitter

© 2020, Built with ❤️+ Gatsby