Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | revert keyword

Improve Article
Save Article
  • Last Updated : 24 Aug, 2022
Improve Article
Save Article

The CSS revert keyword is an inbuilt keyword in CSS which has been used to revert the cascading style to its parent element. If any similar elements hold the same cascading style, but one child holds the revert keyword then the cascading style will be removed and will inherit the cascading from the parent element. 

Syntax:

property: revert;

Below example illustrates the revert keyword in CSS: 

Example: 

html




<!DOCTYPE html>
<html>
    <head>
        <title>CSS revert keyword</title>
        <style>
            /* Color for all the child in parent element */
            div {
                color: green;
            }
             
            /* Specific b and p element color */
            b, p {
                color: black;
            }
             
            /* Performing revert for child /*
            .rvt {
                color: revert;
            }
        </style>
    </head>
    <body>
          
        <!-- Parent elements -->
        <div class="container">
   
            <!-- Child elements -->
            <h1>GeeksforGeeks</h1>
            <b>A Computer Science Portal for Geeks</b>
            <p>I'm not assign in revert</p>
            <p class="rvt">I'm assign in revert</p>
        </div>
    </body>
</html>


Output:

  

Supported Browsers: The browsers supported by CSS revert keyword are listed below:

  • Chrome 84
  • Mozilla Firefox 67
  • Opera 70
  •  Microsoft Edge 84
  • Safari 9.1

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!