HTML CSS Bootstrap JavaScript jQuery MySQL PHP Data Mining

CSS Introduction

Written by RedoHub Team · Last updated: July 31, 2026

CSS stands for Cascading Style Sheets. It is the language used to describe the presentation of a web page — including its colors, layout, fonts, and animations. While HTML defines the structure and content of a page, CSS controls how that content looks and feels.


What is CSS?

  • CSS stands for Cascading Style Sheets
  • CSS describes how HTML elements are to be displayed on screen, paper, or in other media
  • CSS saves a lot of work — it can control the layout of multiple web pages all at once
  • External stylesheets are stored in .css files
  • CSS3 is the latest standard of CSS

Why Use CSS?

Without CSS, every HTML page would look plain and unstyled — just black text on a white background. CSS gives web designers the power to:

  • Apply colors, fonts, and spacing
  • Create multi-column layouts
  • Build responsive designs for different screen sizes
  • Add animations and transitions
  • Keep styling separate from content — making pages easier to maintain

A Simple CSS Example

CSS is applied to HTML elements using rules. A CSS rule consists of a selector and a declaration block:

/* This rule makes all <h1> elements blue and centered */
h1 {
    color: blue;
    text-align: center;
}

Syntax Explained

Part Example Description
Selector h1 Points to the HTML element you want to style
Property color The style attribute you want to change
Value blue The value assigned to the property
Declaration color: blue; A property + value pair, ending with a semicolon

Three Ways to Add CSS

There are three ways to insert CSS into an HTML document:

1. External CSS

The most common and recommended method. A separate .css file is linked in the <head> of your HTML:

<link rel="stylesheet" href="styles.css">

2. Internal CSS

CSS is written inside a <style> tag within the <head> section:

<style>
    body {
        background-color: #f0f0f0;
    }
</style>

3. Inline CSS

CSS is applied directly to a single HTML element using the style attribute:

<p style="color: red; font-size: 18px;">This is a red paragraph.</p>
Note: External CSS is preferred for real projects because it keeps styling centralized and reusable across many pages.

CSS History

Year Version
1996 CSS1 (W3C Recommendation)
1998 CSS2 (W3C Recommendation)
2011 CSS2.1 (revised standard)
2012+ CSS3 (modular — ongoing)
Present CSS Living Standard (W3C)

Key Points to Remember

  • CSS is NOT a programming language — it is a style sheet language
  • CSS rules consist of a selector and one or more declarations
  • CSS3 introduced modules — like Flexbox, Grid, Animations, and Variables
  • CSS is case-insensitive for property names, but values may be case-sensitive
  • Always link your external stylesheet before any inline styles

Common Mistakes to Avoid

Forgetting to link the stylesheet. A missing or misplaced <link rel="stylesheet"> in the <head> means the page loads with zero styling — always double-check the file path.
Relying on inline styles everywhere. style="..." on every element works, but scatters your design across dozens of files instead of one reusable stylesheet — it becomes a maintenance nightmare quickly.
Thinking CSS3 replaced older CSS. CSS3 split CSS into independent modules (Flexbox, Grid, Animations...) that build on CSS2 — it didn't discard anything, so older properties still work fine.

Try It: Style Your First Button

A small external-CSS example showing a hover state — something none of the examples above covered yet:

.my-button {
    background-color: #2e7d52;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
}

.my-button:hover {
    background-color: #1b5e20;
}

Rendered result (hover over it):


Frequently Asked Questions

Q: Is CSS3 a completely different language from CSS?

A: No — CSS3 is the current, modular evolution of the same language. There's no separate "CSS3 syntax" to learn from scratch.

Q: Can I use external, internal, and inline CSS together on one page?

A: Yes, and browsers often will — but be aware of the cascade: inline styles override internal/external ones, and later rules of equal specificity override earlier ones.

Q: Do I need to learn CSS before JavaScript?

A: Not strictly, but most learning paths go HTML → CSS → JavaScript because JS often manipulates elements you've already learned to style. See the MDN CSS guide for the full reference as you go.