HTML and CSS Reference
In-Depth Information
using an asterisk. You can also use the universal selector in combination with other select-
ors—something we'll discuss a little later in this chapter.
Element Type Selector
Also referred to simply as a “type selector,” this selector must match one or more HTML ele-
ments of the same name. Thus, a selector of
nav
would match all HTML
<nav>
elements,
and a selector of
ul
would match all HTML unordered lists, or
<ul>
elements.
The following example uses an element type selector to match all
<ul>
elements:
ul {
list-style: none;
border: solid 1px #ccc;
}
To put this in some context, here's a section of HTML to which we'll apply the above CSS:
<ul>
<li>Fish</li>
<li>Apples</li>
<li>Cheese</li>
</ul>
<div class="example">
<p>Example paragraph text.</p>
</div>
<ul>
<li>Water</li>
<li>Juice</li>
<li>Maple Syrup</li>
</ul>
There are three main elements making up this part of the page: Two
<ul>
elements and a
<div>
. The CSS will apply only to the two
<ul>
elements, and not to the
<div>
. Were we