Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

CSS Value | Initial

  • Last Updated : 19 Aug, 2020

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




<!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>

Output:



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




<!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>

Output:

Supported Browsers:

  • Chrome
  • Safari
  • Edge
  • Firefox
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!