O'Reilly logo

Cascading Style Sheets (CSS) by Example by Steve Callihan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How Inheritance Works

Another key concept is inheritance. Inheritance is the method by which a child element inherits the property values of its parent element, if those property values aren't declared in the child element.

NOTE

A child element is an HTML element that is nested within another element, while a parent element is an element within which another element is nested. In CSS, the term ancestor element is also sometimes used and refers to any element from which an element inherits properties (which could be the parent, grandparent, great grandparent, and so on, of that element).

To see how inheritance works in action, add the following styles to the style sheet for the Northwest Travel Ideas page (see Figure 5.5):

 <style type="text/css"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required