HTML and CSS Reference
In-Depth Information
CHILD SELECTORS
One tool for limiting the scope of CSS is the child selector ( > ). If you no
longer have to worry about Internet Explorer 6 (and, thankfully, many of us
don't), then the child selector should be a regular part of your CSS diet.
Child selectors limit the scope of selectors. Going back to our navigation
example, we can use the child selector to limit the scope of the navigation
so that it does not a " ect the menu.
#nav {
margin: 0;
padding: 0;
list-style: none;
}
#nav > li {
float: left;
}
#nav > li > a {
display: block;
padding: 5px 10px;
background-color: blue;
}
For the menu, let's add a class name to it. This will make it more descriptive
and provide a base for the rest of our styles.
.menu {
margin: 0;
padding: 0;
list-style: none
}
.menu > li > a {
display: block;
padding: 2px;
background-color: red;
}
Search WWH ::




Custom Search