CSS Value | Initial (original) (raw)
Last Updated : 24 Aug, 2022
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:
propertyname: initial;
Example 1: setting font size
html
<!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.
html
<!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 1
- Safari 1.2
- Edge 13
- Firefox 19
- Opera 15
Similar Reads
- CSS Value Inherit The value inherit keyword is used to inherit a property to an element from its parent element property value. The inherit keyword can be used for inheriting any CSS property, and on any HTML element. Inheritance is always from the parent element in the document tree, even when the parent element is 1 min read
- CSS Value Time The CSS Value Time,
- CSS | Value Integer CSS data type integer represents .It is a whole number which can be positive(+) or negative(-) .Integer contains one or more than one digits between 0-9.No decimal value is allowed . No units are required to represent an integer value. A lot of CSS properties take integer value like 2 min read
- CSS Value | Unset To unset the value of an element, unset keyword is used. The unset CSS keyword resets a property of an element to its inherited value if the property naturally inherits from its parent, or to its initial value if it does not inherit. In other words, it behaves like the inherit keyword in the first c 2 min read
- CSS | Percentage Value It represents by takes a number as a parameter. It is used to define the relative size to the parent size. With the help of this, you can adjust all the HTML-CSS elements. In CSS, many properties that take a percentage as parameters such as padding, width, height, margin, and fon 2 min read
- Bulma Initial variables In this article, we will see how the initial variable is used in the webpage. Bulma is a free, and open-source CSS framework based on flexbox. It is component rich, compatible, and well documented. It is highly responsive in nature. It uses classes to implement its design. Initial Variables: This va 5 min read
- CSS Value Resolution CSS Resolution is one of the data-type. As the name suggests it is used for specification of resolution meaning the density of pixels on the output device. Resolutions are generally used while writing media-queries. The user can use the resolution with max and min prefix while writing the media Quer 2 min read
- CSS var() Function The var() function in CSS is used to insert a value for a custom property. Syntax: var( custom_property, value )Parameters: This function accepts two parameters which are listed below: custom_property: It is the required parameter. The name of the custom property must start with two dashes(--).value 2 min read
- CSS Frequency Value The frequency is a data type of CSS value. It represents the frequency dimension of sound like speaking frequency. This value is currently not used by any CSS properties. Back before it was used to measure the sound wave frequency. It holds a number with a unit(Hz or kHz). Syntax: frequency: number 2 min read
- CSS Value | Angle The angle on CSS represents a certain angle value that can be expressed in degrees, gradians, radians, or turns. Angle value can be used for rotations, transformations or gradients, etc. Syntax: The angle consists of a number followed by one of the allowed units. property: number unit; Allowed units 2 min read