CSS Course

Lesson 1: Introduction to CSS

What is CSS?

CSS (Cascading Style Sheets) is the language used to style and format HTML documents. It controls colors, fonts, layouts, spacing, and even animations. By separating content (HTML) from presentation (CSS), websites become easier to maintain and style.

Why Use CSS?

Ways to Add CSS

There are three main ways to apply CSS to HTML:

  1. Inline CSS: Using the style attribute directly in an element.
  2. Internal CSS: Using a <style> block inside the HTML file's head section.
  3. External CSS: Linking to a separate .css file (the preferred method).

Example of CSS in Action


/* style.css */
body {
  background-color: #f0f8ff;
  font-family: Arial, sans-serif;
  color: #333;
}
      

This CSS changes the background color of the whole page, sets a font family, and changes the text color.