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
<body> <div >      <h1>          Heading here      </h1>      <p >          Lorem ipsum dolor sit amet.      </p>      <p>          Lorem ipsum dolor <a href="#">sit</a> amet.      </p> </div> <div >      <ul>          <li><a href="#" >item 1</a></li>          <li><a href="#">item 2</a></li>          <li><a href="#">item 3</a></li>      </ul> </div> <div >     Lorem ipsum dolor <a href="#">sit</a> amet. </div> </body> 

What Is a <div>?

The <div> element is a generic container that can be used to add structure to an HTML document. Although it is a block level element, it does not add any other presentation to the content.


For this lesson, the <div> element has been used to contain logical divisions of content, such as navigation and footer information.

These divisions of content can then be styled to suit your needs using descendant selectors, which are covered later in this lesson.





Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net