DevAcademy
LearnCSSCSS Introduction
BeginnerCSS

CSS Introduction

Understand what CSS is, how it styles HTML, and how it works together with HTML and JavaScript to build modern web pages.

Reading Time

10 min

Lesson

Lesson 1 of 30

What is CSS?

CSS (Cascading Style Sheets) is the language used to style HTML. It controls colors, fonts, spacing, layout, and animation — everything about how a page looks, without changing the underlying content.

How CSS Works

CSS works by selecting HTML elements and applying rules to them. A rule is made up of a selector (which elements to target) and a declaration block (which styles to apply).

Your First CSS Rule

<style>
  p {
    color: steelblue;
    font-size: 20px;
  }
</style>

<p>This paragraph is styled with CSS.</p>
<p>So is this one — the rule applies to every &lt;p&gt;.</p>
Output

Quick Facts

FeatureValue
Stands ForCascading Style Sheets
First Released1996
Maintained ByW3C (CSS Working Group)
File Extension.css
Works WithHTML and JavaScript

The Cascade

"Cascading" describes how CSS resolves conflicts when multiple rules target the same element — styles cascade based on source order, specificity, and importance, with later, more specific, or "!important" rules typically winning.

What CSS Can Control

  • Colors and backgrounds
  • Typography — fonts, size, spacing
  • Layout — position, size, and alignment of elements
  • Responsive behavior across screen sizes
  • Transitions and animations

HTML, CSS, and JavaScript

HTML provides structure, CSS provides presentation, and JavaScript provides behavior. Learning HTML first makes CSS click faster, since every CSS rule needs elements to target.

Best Practice

Keep style out of your HTML as much as possible — use CSS rules in a stylesheet rather than inline styles, so your markup stays clean and your styling stays reusable.

Interview Questions

Quick Quiz

1. What does CSS stand for?

2. What are the two main parts of a CSS rule?

3. What does "cascading" refer to in CSS?

Next