If you’ve ever wanted to do something like set the borders on a container to the same color as the text within it you can easily do it using currentColor.

currentColor can be used for anything that accepts a color value like box-shadow, background-color, etc.

The CSS

The Demo

My border should have a color of red which matches the color of my text

Browser Support

ie9 and aboveChrome 1 and aboveFire Fox 3.5 and aboveOpera 11 and aboveSafari 4 and above

CSS currentColor has pretty good browser support working in all modern browsers. Not supported in ie8 and below.

Comments