TExcelTAD
Home › CSS › CSS Intro

CSS Introduction

CSS stands for Cascading Style Sheets. It is the language that controls how web pages look: colors, fonts, spacing, sizes, layout, and even animation. HTML describes what is on the page (a heading, a paragraph, a list); CSS describes how it should be presented.

Without CSS, every web page would look like a plain text document: black serif text on a white background, stacked from top to bottom. With CSS, the very same HTML can become a sleek dashboard, a colorful blog or a mobile-friendly shop.

Why CSS matters

Without CSS With CSS
Default browser fonts and colors Your own brand colors and typography
Everything stacked vertically Columns, grids, sidebars and cards
One look for every screen Layouts that adapt to phones, tablets and desktops
Style repeated in every HTML tag One stylesheet styles hundreds of pages

That last point is the big one. Before CSS existed, authors used HTML attributes like <font color="red"> on every single element. Changing the site's color meant editing every page. With CSS you change one rule in one file, and the whole site updates.

Your first styled page

Press ▶ Run to render the page below. Then try changing tomato to seagreen or navy and run it again.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
<style>
  body {
    background: #f4f6fb;
    font-family: system-ui, sans-serif;
  }
  h1 {
    color: tomato;
    text-align: center;
  }
  p {
    font-size: 20px;
    color: #333;
    text-align: center;
  }
</style>
</head>
<body>
  <h1>Hello, CSS!</h1>
  <p>This page is styled by three small CSS rules.</p>
</body>
</html>

Everything inside the <style> element is CSS. Each block (body { ... }, h1 { ... }, p { ... }) is a rule that says "find these elements and apply these styles".

What does "cascading" mean?

A single element can be targeted by several rules at once — a rule for all paragraphs, another for paragraphs with a certain class, and maybe an inline style too. The browser combines them according to a set of priorities called the cascade. Rules that are more specific, or that appear later, win when they conflict. You will study this in detail in the Specificity lesson; for now, just know that styles flow down and combine.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
<style>
  p { color: gray; font-size: 18px; font-family: sans-serif; }
  p { color: purple; }          /* later rule wins for color */
  .special { color: darkorange; font-weight: bold; }
</style>
</head>
<body>
  <p>I am purple — the second rule overrode gray.</p>
  <p class="special">I am orange and bold — my class is more specific.</p>
  <p>I still get 18px from the first rule.</p>
</body>
</html>

Notice that the third paragraph keeps the font-size from the first rule even though its color came from the second rule. Properties that do not conflict simply add up.

Same HTML, different look

The real power of CSS is separating content from presentation. Here is one card of HTML; only the CSS makes it look like a card.

html · try it yourself
<!DOCTYPE html>
<html>
<head>
<style>
  body { font-family: system-ui, sans-serif; background: #e9eef7; padding: 20px; }
  .card {
    max-width: 260px;
    margin: auto;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
    text-align: center;
  }
  .avatar { font-size: 48px; }
  .card h2 { margin: 8px 0 4px; color: #264de4; }
  .card p { margin: 0; color: #666; }
</style>
</head>
<body>
  <div class="card">
    <div class="avatar">🦊</div>
    <h2>Fox the Designer</h2>
    <p>Loves clean layouts and bold colors.</p>
  </div>
</body>
</html>

Tip: Delete the whole <style> block and run the example again to see how much work CSS is doing.

What you will learn in this course

  • Basics – syntax, selectors, colors, backgrounds, borders, the box model, text and fonts
  • Layout – display, positioning, floats, Flexbox and Grid
  • Advanced effects – gradients, shadows, transforms, transitions and animations
  • Responsive design – media queries and fluid units so pages work on any screen

Note: Every example on ExcelTAD runs live in your browser. Edit any value and press Ctrl+Enter to see the result immediately.

Test yourself

What does CSS stand for?

  1. Creative Style System
  2. Cascading Style Sheets
  3. Computer Styled Sections
  4. Colorful Sheet Syntax

What is the main job of CSS?

  1. Defining the structure and content of a page
  2. Storing data in a database
  3. Controlling how HTML elements are presented
  4. Running logic on the server

Two rules set different colors on the same paragraph with equal specificity. Which wins?

  1. The first one
  2. The one that appears later
  3. Neither - the text becomes black
  4. The browser picks randomly