Back to Guide
.css

Cascading Style Sheets

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML.

Technical Specs

MIME Type
text/css
Related Formats
SCSSLESSSTYLUS
Advertisement

History & Origin

Proposed by Håkon Wium Lie in 1994. Before CSS, styling was done with HTML attributes (like <font color="red">), which was unmaintainable.

Internal Structure

CSS consists of a list of rules. Each rule has a selector (targeting an element) and a declaration block (properties and values). Examples: `h1 { color: blue; }`.

Advantages

  • Separation of concerns: Keeps content (HTML) separate from design (CSS).
  • Reusability: One CSS file can style an entire website.
  • Power: Can control layout, typography, and animation.

Disadvantages

  • Complexity: Large codebases can become hard to manage (hence tools like Sass/Tailwind).
  • Global scope: Classes conflict if not named carefully.
  • Browser support: New features take time to be supported everywhere.

Common Use Cases

Styling web pages
Layout design (Grid, Flexbox)
Animations and transitions
Responsive design (Media queries)
Advertisement
Buy me a coffee