Inheritance in CSS means that some properties are automatically passed down from a parent element to its child elements.
Properties such as color
, font-family
, and line-height
are inherited, while others like margin
, padding
,
and border
are not.
/* Example of inheritance */ .parent { color: blue; /* This property will be inherited by children */ font-size: 20px; /* This property will also be inherited */ } .child { font-weight: bold; /* This property will not be inherited */ }