What is CSS?

  • CSS stands for Cascading Style Sheets.
  • CSS describes how HTML elements are displayed: colors, fonts, spacing, layout, animations.
  • One style sheet can control the look of every page of a website.
  • HTML gives a page its structure; CSS gives it its presentation.

CSS Demo

Example

The same HTML, styled with a few CSS rules:

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <style>
    body { font-family: Arial, sans-serif; background: #f4f6f8; }
    h1 { color: #04AA6D; text-align: center; }
    p { background: white; padding: 12px; border-left: 4px solid #04AA6D; }
  </style>
</head>
<body>

<h1>My First CSS Example</h1>
<p>This is a paragraph styled with CSS.</p>

</body>
</html>

Result

Why Use CSS?

Before CSS, styling was done with HTML attributes like <font color="red"> on every element, which made large sites a nightmare to change. With CSS, design lives in separate files: change one rule and the whole site updates.