Nested Tags
When one HTML tag is contained within another, it is nested and therefore can inherit the style settings from the outer tag.
[Menu Proxy — Headings — Online — Depth3 ]
How to Edit Nested Style Elements
- From the Content Explorer, open Austin-City-Limits.htm.
- At the end of the "Format" section, create an empty paragraph.
- From the Home ribbon, click
. This groups selected items.
-
From the Create Group dialog, select div. Click OK.
-
Type Willie Nelson was the first featured performer. Notice the default paragraph font color is black.
- Open Styles.css.
- From the Styles drop-down, select All Styles.
- In the left pane tree structure, select the div style.
- From the local toolbar, Show drop-down, select Show: Set (Locally) Properties - properties set in this stylesheet.
-
In the Add Property drop-down, select color.
-
In the Color Property field, replace the default property "inherit," by typing a new value of Purple. Press ENTER.
Note You might not see the purple color display right away, and that is okay. When you press ENTER and save the stylesheet, those actions enforce the style update.
-
Click
to save all files.
-
Open the Austin City Limits topic. Since the p element is within the div element (and the div is the wrapping container tag that holds the style), the paragraph text within the div inherits the div style of purple font.
- In the stylesheet, select the p style.
- In the Add Property drop-down, select color.
-
In the Color Property field, replace the default property "inherit," by typing a new value of Gray. Press ENTER.
-
Click
to save your work.
-
Open the topic again. Since the p element is within the div element, it is “closer” to the source, and the text turns gray.
-
Open Famous-Austin-Folks.htm. Let’s change the color on the list styles so all the text in the project appears the same.
- Open Styles.css.
- From the Styles drop-down, select List Styles, and then select li.
- In the Add Property drop-down, select color.
- In the Color Property field, replace the default property "inherit," by typing a new value of Gray. Press ENTER.
-
Click
to save all files.
- Go back to the Famous Austin Folks topic to check the list items color update.
- From the Window ribbon, select Close All Documents.
Note Cascading stylesheet (CSS) rules account for cascading order, specificity, and inheritance. All of which determine the look and feel of the project.
Ta-Da!
Congratulations! You've reached the end of this tutorial.
To go through other style tutorials, click here.
To check out additional tutorials, click here.