HTML and CSS Reference
In-Depth Information
compound selectors
It is often beneficial to limit CSS rules to a tightly defined section of the page. Rather than create a
specific ID or class for such sections, designers often opt for a compound selector that targets the
area contextually.
Say, for example, that you need to make all <h1> tags in the sidebar green. Instead of creating and
applying a series of classes, you can define a compound selector, like this:
#sidebar h1 {
color: green;
This selector will apply to any <h1> tag within any HTML element with an ID of sidebar .
Compound selectors can utilize any combination of tags, IDs, and classes.
You'll be using CSS — with a full range of selectors, properties, and values — throughout the topic
to help you better understand how HTML5 tags are used to create coherent web pages.
Because this lesson just covers some of the basics of CSS, there is no accompany-
ing Try It and video. Starting in Lesson 5, you'll begin some real hands-on work
using CSS.
Search WWH ::

Custom Search