Anatomy of HTML Elements and CSS Rules

A set of HTML tags or a singular/self-closing HTML tag is an called an HTML element

A set of CSS code is called a CSS Rule.

Below is an image of an HTML elemenet's anatomy...

HTML anatomy

Below is an image of a CSS rule's anatomy...

css anatomy

Notes:When you are styling a website using CSS. It is best to use only class selectors and element selectors when necessary.

Use a selector in CSS to change this HTML element

Use a class selector to change this.

Use an id selector to change this.

Stacking Classes

It is possible to declare more than one class on an HTML element. This allows you to save time by only having to write a CSS rule once and then reuse it.

This paragraph has a color.

This paragraph is bold.

This paragraph has combined classes from the two above it.