Select Page

Understanding HTML Elements in CSS


Before you can style a webpage with CSS, you first need to understand the elements that CSS is designed to style.


nanadwumor

September 19, 2026

introduction online


  • Elements are the building blocks of webpages.
  • Examples include headings, paragraphs, images, links, and buttons.
  • HTML elements are written using tags, such as <p>This is a paragraph.</p>.
  • CSS selects and styles elements, such as p { color: blue; }.

RECOMMENDED ARTICLES


How to Select Following Siblings in CSS
How to Select Following Siblings in CSS

What if you want to style a paragraph that is far away from a heading but still inside the same container? CSS has a neat trick for that. The [crayon-6aae9e1b3c10f730646375-i/] selector styles elements that come later in the same parent. Elements...

How to Use the Child Combinator in CSS
How to Use the Child Combinator in CSS

How to target exactly the elements you want with CSS combinators! > selects direct children only (e.g., h2 > em) Space selects all descendants, any depth (e.g., h2 em) Combinators can be combined (e.g., div.sale p > em) + selects...

Descendant Selectors in CSS
Descendant Selectors in CSS

Unlock the power of CSS by learning how HTML’s hierarchy shapes every style you apply! HTML elements form nested parent-child structures. Parents are directly above children; ancestors can be higher up. Descendant selectors style elements inside a...


Before learning advanced CSS, you must first understand elements.
CSS works by selecting and styling elements.
If you do not understand elements properly, CSS will feel confusing later.

What Is an Element?

An element is a building block of a webpage.

Everything you see on a webpage is created using elements.

Examples include:

headings

paragraphs

images

links

buttons

tables

forms

In HTML, elements are written using tags.

Example of an HTML Element

Why Elements Matter in CSS

CSS styles elements.

For example:

Here: 

<p> is the opening tag. 

</p> is the closing tag

“This is a paragraph.” is the content. 

Together, they form an element.

This CSS rule changes all paragraph elements to blue.

Without elements, CSS would have nothing to style.