Chapter 16. JavaScript and CSS

After completing this chapter, you will be able to

  • Understand the basics of Cascading Style Sheets (CSS).

  • Understand the relationship between JavaScript and CSS.

  • Use JavaScript to change the style of an individual element.

  • Use JavaScript to change the style of a group of elements.

  • Use JavaScript to provide visual feedback on a web form using CSS.

What is CSS?

Using CSS, you can specify the look and feel of a webpage: you can apply color, fonts, and layout to the elements of a page.

Figure 16-1 shows a basic webpage. It’s fairly boring—or at least the layout is.

A basic webpage with no styles applied.
Figure 16-1. A basic webpage with no styles applied.

By using CSS, ...

Get JavaScript Step by Step 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.