Skip to content

Instantly share code, notes, and snippets.

@felipefialho
Last active December 19, 2018 19:18
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipefialho/c51fbe3a14332bb7b2767fb61bae2736 to your computer and use it in GitHub Desktop.
Save felipefialho/c51fbe3a14332bb7b2767fb61bae2736 to your computer and use it in GitHub Desktop.
[CSS Trick] Capitalize the first letter only

Capitalize the first letter only

.foo
  text-transform lowercase
  
  &:first-letter 
    text-transform uppercase

!important, it just works when the parent is a block or inline-block.

🦁

@renatorib
Copy link

renatorib commented Nov 24, 2016

It's important to emphasize that if is only one word, you can just use text-transform: capitalize; (that capitalize first letter of all words)

@felipefialho
Copy link
Author

@renatorib Exactly!

@PabloDinella
Copy link

It's also good for drop caps :) https://css-tricks.com/snippets/css/drop-caps/

@Michaela-Davis
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment