Explain inheritance as it applies to writing simpler style rules.

What will be an ideal response?

The elements in an HTML document are structured in a hierarchy of parent and child elements. Parent elements contain nested elements called child elements. Both  and are immediate child elements of . Yet, and are parent elements as well, because they contain other nested elements. As you travel further down the document hierarchy, you find additional elements that are both parent and child elements, such as

and

    . By default, most CSS properties inherit from parent elements to child elements, which is called inheritance. You can style multiple document elements with just a few style rules if you let inheritance work for you.For example, consider the following set of style rules for a document.

    This style sheet sets the color to red for five elements in the document. Inheritance lets you write a far simpler rule to accomplish the same results:

    This rule works because all of the elements are children of and because all the rules are the same. It is much more efficient to write a single rule for the parent element and let the child elements inherit the style.

    Computer Science & Information Technology

You might also like to view...

Access allows you to add some ________ to your database to help ensure the data's validity

A) junctions B) integrity constraints C) cardinality D) domain integrity constraints

Computer Science & Information Technology

____________________ cabling is cable that runs between network equipment rooms, floors, and buildings.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology