⌨️
Web Design
  • Index
  • Front End
    • Front End Index
  • HTML/CSS/JS
    • HTML Index
      • Page layout
      • Form
      • Image Optimization
    • CSS Index
      • CSS Selectors
        • Selectors
        • Combinators
        • Attribute Selectors
        • Pseudo classes
      • CSS Cascade and Inheritance
        • Cascade
        • Inheritance
      • Specificity
      • Box Model
      • CSS Clearfix
      • Responsive Meta Tag
      • Flexbox Layout
      • Grid Layout
      • CSS Naming Rules
        • Golden Guidelines for Writing Clean CSS
        • BEM
        • Rules
      • Frameworks & Libraries
    • JS Index
      • JS loading
      • Modules
      • Js Array Common Method 1
      • Js Array Common Method 2
      • Custom attributes on the element
      • Operator
      • Parse a JSON Date in JavaScript
      • Importmap
  • Git
    • Git Index
    • Initialize a Repository
    • Top 20 Git Commands With Examples
  • UML
    • UML Class
  • React
    • Index
      • setState async issue
      • Redux
      • Axios
      • useState update in A Timeout
  • WebGL
    • WebGL Index
  • Back End
    • Back-End Index
      • Knex
      • Bookshelf
        • bookshelf install
        • Bookshelf only returns one row
      • Server side init flow
      • Install Wordpress on Ubuntu 22.04 with a LAMP Stack
  • React Native
    • React Native Index
      • Dynamically changing Image URLs in React Native
  • Expo
    • EAS build config
Powered by GitBook
On this page
  • Inheritance
  • Controlling Inheritance

Was this helpful?

  1. HTML/CSS/JS
  2. CSS Index
  3. CSS Cascade and Inheritance

Inheritance

Inheritance

When no value is specified for a property, the value of the parent element property can be inherited as part of the defaulting process. It’s worth noting however that not all property values are automatically inherited. For example, developers likely wouldn’t want a width property to be inherited by child elements for a layout.

Controlling Inheritance

Developers can assign special property values in order to control inheritance if needed.

inherit will trigger the inheritance of the computed value of its parent element and can be applied to any CSS property.

initial applies the initial or default value of a property as set by the browser.

unset resets the property to its inherited value if available or to its initial value if not. unset can be thought of as a conditional combination of inherit and initial

revert is a newer option but not widely supported by major browsers. It will rollback the value of a property to the value it would have if no changed had been made within the context of its origin.

PreviousCascadeNextSpecificity

Last updated 4 years ago

Was this helpful?