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

types of elements


  • 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


The @import Element – When Is It Used In CSS?
The @import Element – When Is It Used In CSS?

Discover how the [crayon-6ae472aa8ea28705213497-i/] rule lets you modularize and combine your CSS files like a pro! Function: The [crayon-6ae472aa8ea52543232664-i/] rule loads one stylesheet inside another. Placement: It must always appear before...

The Style Element in CSS
The Style Element in CSS

Learn how to quickly add CSS directly to your HTML using the [crayon-6ae472aa8f93a883423342-i/] element without any external files required! Definition: The [crayon-6ae472aa8f95e294487915-i/] element adds embedded CSS directly inside an HTML...

Alternate Stylesheets in CSS
Alternate Stylesheets in CSS

Discover how native HTML and CSS allow users to switch website themes effortlessly without JavaScript! Persistent Stylesheets: Have no [crayon-6ae472aa906d5005290387-i/] and are always active. Preferred Stylesheets: Have 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

Here : 

<p> is the opening tag

</p> is the closing tag

“This is a paragraph.” is the content

Together, they form an element.

Why Elements Matter in CSS

CSS styles elements.

For example:

This CSS rule changes all paragraph elements to blue.

Without elements, CSS would have nothing to style.