
- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Advanced Features
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS - all Property
CSS all property resets all properties of an element, with the exception of unicode bidi, direction and CSS custom properties. It can reset properties to their original or inherited values or to the values explicitly defined in another cascade layer or in the stylesheet origin.
Syntax
all: initial | inherit | unset;
Property Values
Value | Description |
---|---|
initial | It changes all the properties applied to an element or to its parent to their initial value. |
inherit | It changes all the properties applied to an element or to its parent to their parent value. |
unset | It changes all the properties applied to the element or the element's parent to their parent value if they are inheritable else to their initial value if not |
Examples of CSS All Property
The following example explains the all property with different values.
All Property with Initial Value
To let an element's properties be set to their default values assigned by the browser such that no defined styling is applicable to them, we use the initial value. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> html { font-size: 25px; color: lightcoral; font-style: italic; } #custom1 { background-color: #ecf0f1; color: #e74c3c; } #custom2 { all: initial; } </style> </head> <body> <h2> CSS all property </h2> <div id="custom1"> See how this sentence changes!- This is reference sentence </div><br/> <div id="custom2"> See how this sentence changed. This sentence is using initial value so it does not inherit anything from its parent element or html element, this is evident from the text style and color. </div> </body> </html>
All Property with Inherit Value
To let an element's properties be set to the properties of the element's parent or the html element then, we use the inherit value. The properties defined by the parent if present will be applied if not then the html element properties will be applied. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> html { font-size: 25px; color: lightcoral; font-style: italic; } #custom1 { background-color: lightgreen; font-weight: bold; padding: 10px; color: #e74c3c; } #custom2 { all: inherit; } </style> </head> <body> <h2> CSS all property </h2> <div id="custom1"> See how this sentence changes!- This is reference sentence </div><br/> <div id="custom2"> See how this sentence changed. This sentence is using inherit value so it inherits the properties from its parent or from the html element, in this case the html element. It has inherited font-size, color and font-style. </div> </body> </html>
All Property with Unset Value
To let the properties of an element be obtained from its parent if present or from html element if absent or from the default values decided by the browser (behave like initial) in the absence of both then, we use unset value. This is shown in the following example.
Example
<!DOCTYPE html> <html> <head> <style> .parent { color: purple; font-weight: bold; font-size: 20px; text-align: center; background-color: lightgrey; } .custom1 { font-weight: bold; padding: 10px; } .custom2 { all: unset; } </style> </head> <body> <h2> CSS all property </h2> <div class="parent"> <div class="custom1"> This sentence is using the 'unset' value and also has a parent, so it inherits the parent properties. </div> </div> <br/> <div class="custom2"> This sentence is also using the 'unset' value but it doesnt have a parent, so it follows the initial value getting default values. </div> </body> </html>
Supported Browsers
Property | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
all | 37.0 | 79.0 | 27.0 | 9.1 | 24.0 |