01. Introduction to CSS

Recall from our HTML Tutorial series that HTML defines the content of the page. This tutorial series will teach you how to use CSS, which is used to define the presentation. We will then go over JavaScript, which handles the behavior.

Long, long ago, developers used to placed their styling rules within HTML elements. However, it soon became too complex to keep track of everything, let alone apply stylings to multiple elements. To make life easier, the World Wide Web Consortium (W3C) created CSS!

The Basics

CSS stands for Cascading Style Sheets and is used to define how HTML elements should appear.

CSS rules contain two parts: a selector and a declaration. The declaration consists of a property and value:

/* My first CSS block! */
p {
  color: red;
  font-size: 20px;


Here, the selector is the p element. This means that all corresponding <p> tags within our HTML documents are chosen.


The declaration then applies styles to the chosen element. It is wrapped in curly braces {}.


Within the declaration are properties. Here, they arecolor, and font-size, which sets the text color and size respectively.

The property values are red and 20px, making our text look like this!

Notice how each declaration is separated by a semi-colon. Think of this as the English sentence, "Select all paragraph tags in our HTML document and set the color to red and font-size to 20px."


And lastly, to add comments within CSS documents we start with a /* and end with a */.

Simple enough, right? Now let's learn how to link your CSS rules to an HTML document!

Build modern and responsive webpages

Responsive Typography

Build modern and responsive webpages Try Front-end

Responsive web design helps your site maintain its design integrity on a variety of screen sizes, but how does it affect your typography? With this practical book, graphic designers, web designers, and front-end developers alike will learn the nuts and bolts of how to get the best appearance from type without sacrificing performance on any device.

$ Check price
24.9924.99Amazon 4.5 logo(3+ reviews)

More Front-end resources

Aching back from coding all day?

Prism Glasses

Aching back from coding all day? Try Back Problems

Ever feel achy from sitting crunched up on your computer table? Try lying down with these optical glasses that allow you to work on your laptop while lying flat on your back. This is the perfect solution with those with limited mobility or those who wish to prevent neck cramps and back strains.

$ Check price
4.454.45Amazon 4 logo(128+ reviews)

More Back Problems resources