CSS all Property

You are Here:

CSS all Property

CSS all property resets all of an element's properties (except unicode-bidi and direction).

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> p:nth-child(3){ all: none; } p:nth-child(5){ all: initial; } p:nth-child(7){ all: inherit; } p:nth-child(9){ all: unset; } </style> </head> <body> <h1>CSS all Property</h1> <h2>all: none;</h2> <p>This is a paragraph.</p> <h2>all: initial;</h2> <p>This is a paragraph.</p> <h2>all: inherit;</h2> <p>This is a paragraph.</p> <h2>all: unset;</h2> <p>This is a paragraph.</p> </body> </html>

Syntax

Using CSS

element{ all: inherit; }

Using Javascript

object.style.all="inherit";

Animatable

No, all property is not animatable. CSS Animatable Properties Reference.

Default Value

Default value for CSS all property is none.

Property Value

The following table provides a list of values for CSS all property.

ValueExplanation
noneNo Effect will take place.
initialSpecifies that all the element's properties should be changed to their initial values.
inheritSpecifies that all the element's properties should be changed to their inherited values.
unsetSpecifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not.

Using JavaScript

In the following example, we will demonstrate how to change the CSS all property of an element using JavaScript.

Example

HTML Online Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>CSS all Property</h1> <p style="color: green;"> This is a paragraph.</p> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("p")[0]; function myFunction(){ x.style.all = "initial"; } </script> </body> </html>

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author