Reminder: Current Color in CSS

Reminder to self, as I seem to keep forgetting this (even after having blogged about it 3 years ago): you can use currentColor as a color value in CSS. Be it for background-color, border-color, etc. — they all accept currentColor.

The value it represents is the current color, so if that one changes so will currentColor. Handy if you’re styling components based on the text color, as seen below:


Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Unless noted otherwise, the contents of this post are licensed under the Creative Commons Attribution 4.0 License and code samples are licensed under the MIT License

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.