Home > Articles

Selectors in Action

  • Print
  • + Share This
This chapter is from the book

In this lesson, you will learn about the different types of selectors and how to use them.

Setting Up the HTML Code

Selectors are one of the most important aspects of CSS because they are used to "select" elements on an HTML page so that they can be styled. The HTML code for this lesson is shown in Listing 3.1.

Listing 3.1 HTML Code Containing Markup for Lesson 3

<div id="content">
  Heading here
 <p class="intro">
  Lorem ipsum dolor sit amet.
  Lorem ipsum dolor <a href="#">sit</a> amet.
<div id="nav">
  <li><a href="#" class="intro">item 1</a></li>
  <li><a href="#">item 2</a></li>
  <li><a href="#">item 3</a></li>
<div id="footer">
 Lorem ipsum dolor <a href="#">sit</a> amet.
  • + Share This
  • 🔖 Save To Your Account