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 asand
- . 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...
To add animations in PowerPoint you must be in ________ view
A) Outline B) Slide Sorter C) Normal D) Slide Show
Computer Science & Information Technology
A row of information in a data source is referred to as a field
Indicate whether the statement is true or false
Computer Science & Information Technology
When would you want to copy an existing query?
What will be an ideal response?
Computer Science & Information Technology
By default, the Max. Units field is ____.
A. 0% B. 50% C. 100% D. 200%
Computer Science & Information Technology