Styles and Cascading Style Sheets

In this lesson, we will learn about styles and CSS. Let's begin!

Chapter overview

In the previous chapters, you learned about establishing the structure of your web pages with HTML and using the JavaScript programming language to manipulate the page structure to create interactive pages that respond to user events.

In many sample programs, you already used Cascading Style Sheets to set up the appearance of pages, including typography, colors, layout, and so on.


In the early days of HTML styling was part of the markup language. A number of HTML tags existed only for the sole purpose of providing style for parts of the web page such as font type, color, alignment, margins, paddings, etc. This structural approach resulted in verbose web pages where structural elements were mingled with styling elements.

Where a certain set of style attributes were used in many different parts of a page, it meant redundancy: the HTML markup snippets that specified a particular style had to be repeated for every structural part where the style should have been applied. This approach not only increased the size of web pages but also made them more laborious to maintain.

Get hands-on with 1200+ tech skills courses.