Inheritance Basics

Inheritance is the process by which some CSS properties applied to one tag are passed on to nested tags also called as child tag. When a property has been applied to a particular element, its children retain those property values as well and is called inheritance. But all properties are not inherited but most are. An example is given as

body {
width: 650px;
margin: 0 auto;
background: #000; color: #FFF;
font: 12px sans-serif;
}

In this example the styling for text like the color which is white (#FFF), is inherited by all elements nested in it. But, width and margin are not inherited.
Share this post
[social_warfare]
Cascade and Inheritance
Why Inheritance

Get industry recognized certification – Contact us

keyboard_arrow_up