DEV Community

TK
TK

Posted on

Use-case for css `revert` value

I know that css has revert value, but when to use? πŸ€”

One of the use-case

When reseting the link decoration but want to have the decoration back when hovering the element.

Image description

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: revert;
  /* text-decoration: underline; */
}
Enter fullscreen mode Exit fullscreen mode

What's good about it?

I think it is slightly better than giving text-decoration: underline; explicitly, in order to be flexible for changes.

Any other use-cases??

Please leave a comment if you know other commonly used use-cases for revert πŸ™

Latest comments (0)