4. Introduction to Cascading Style Sheets™ (CSS): Part 1

Fashions fade, style is eternal.

—Yves Saint Laurent

How liberating to work in the margins, outside a central perception.

—Don DeLillo

Objectives

In this chapter you’ll:

• Control a website’s appearance with style sheets.

• Use a style sheet to give all the pages of a website the same look and feel.

• Use the class attribute to apply styles.

• Specify the precise font, size, color and other properties of displayed text.

• Specify element backgrounds and colors.

• Understand the box model and how to control margins, borders and padding.

• Use style sheets to separate presentation from content.

Outline

4.1 Introduction

4.2 Inline Styles

4.3 Embedded Style Sheets

4.4 Conflicting Styles

4.5 ...

Get Internet & World Wide Web: How to Program, Fifth Edition now with O’Reilly online learning.

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