Chapter 7

Cascading Style Sheets

What You Will Learn in This Chapter

  • What makes up a CSS rule
  • How properties and values control the presentation of different elements within your document
  • How to control the presentation of text using CSS
  • How CSS is based on a box model, and how you set different properties for these boxes (such as width and styles of borders) Code Downloads for this Chapter

The code downloads for this chapter are found at on the Download Code tab. The code is in the Chapter 7 download and individually named according to the names throughout the chapter.

Having learned how to structure the content of your documents using HTML’s wide variety of elements and attributes, you can now start making your pages look a lot more exciting.

In this chapter, you learn how to use cascading style sheets (CSS) to take control of the style of your pages, including the color and size of fonts, the width and color of lines, and the amount of space between items on the page. The cascading style sheets specification works by enabling you to specify rules that say how the content of elements within your document should appear. For example, you can specify that the background of the page is a cream color, the contents of all <p> elements should display in gray using the Arial typeface, and all <h1> elements should be in red using the Times New Roman typeface.

By the end of the chapter, you should be confidently writing CSS ...

Get Beginning HTML and CSS now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.