CSS Value | Initial

The initial value keyword is used to set an element’s CSS property to its default value.

The initial keyword can be used for any CSS property, and on any HTML element.

Syntax:

property_name: initial;

Example 1: setting font size

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
  <title>CSS | value unset</title>
</head>
<style>
  
span {
    color: blue;
}
.gfg {
    color: unset;
}
</style>
<body>
    <h1 style="text-align: center; color: green;">
         GeeksforGeeks
   </h1>
    <div style="text-align: center;">
     <span class="gfg">Font color unset</span>
    </div>
</body>
</html>

chevron_right


Output:



Example 2: Unsetting the font color to equivalent parent element’s value.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
  <title>CSS | value unset</title>
</head>
<style>
  
span {
    color: blue;
}
.gfg {
    color: unset;
}
</style>
<body>
    <h1 style="text-align: center; color: green;">
         GeeksforGeeks
   </h1>
    <div style="text-align: center; color: green;">
     <span class="gfg">
  Font color unset inherited from parent div
    </span>
    </div>
</body>
</html>

chevron_right


Output:

Supported Browsers:

  • Chrome
  • Safari
  • Edge
  • Firefox
  • Opera



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.