Phong Duong

🔎Search

Reset a property in CSS

25-03-2021 | #css

To reset a property in CSS, you use the unset keywork for its value.

The property will be reset to its inherited value if the property naturally inherits from its parent, and to its initial value if not.

In the demo, the first paragraph is green, the second one is black. The second paragraph's color has the unset keywork. It reset the property to the initial value, black.

In the div element, its color will be red. But I set the paragraph's color to yellow. After that, I reset the color property. Because the paragraph inherits color's value from its parent element, div. So that after being reset, the paragraph is red.

Share: TwitterFacebookLinkedInHacker News