CHAPTER 7

Getting Started with CSS

In this chapter, you start working with Cascading Style Sheets, CSS. After learning how CSS works and how to distinguish inline, internal, and external CSS, you start using these types of CSS to apply formatting. You then move on to working with element selectors, class selectors, and ID selectors.

image

Grasp How CSS Works

Format Elements with Inline CSS

Format a Page Using Internal CSS

Create an External CSS File

Link an External CSS File to a Web Page

Distinguish Element, Class, and ID Selectors

Apply Styles Using Element Selectors

Apply Styles Using Class Selectors

Apply Styles Using ID Selectors

Grasp How CSS Works

Cascading Style Sheets, usually abbreviated to CSS, is a style sheet language used to describe how to display documents written in HTML, such as web pages, and other markup languages. CSS works by implementing a series of rules that control the display of the elements that make up the web page. CSS rules can apply either to specific elements or to groups of elements, as needed. CSS rules can be defined in three locations: first, inline, meaning inside the element; second, internally, meaning elsewhere in the same HTML document; or third, externally, meaning in a separate file linked to the document.

The CSS Cascade

You can use CSS in three ways in your web pages: as inline CSS, as internal CSS, and as external CSS. The following ...

Get Teach Yourself VISUALLY HTML and CSS, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.