Skip to content

Day 1: What is CSS & Inclusion Methods

Understand the syntax of CSS rules and how to link external stylesheets to HTML pages.

selector {
property: value;
}
  1. External Stylesheet (Best Practice): Linked in <head> using <link>. Keeps structure separate from presentation.
    <link rel="stylesheet" href="styles.css" />
  2. Internal Stylesheet: Embedded in <head> inside <style> tags. Useful for single-page experiments.
    <style>
    h1 { color: #2563eb; }
    </style>
  3. Inline Styles: Added directly via the style attribute on an HTML element (avoid in production).
    <p style="color: red;">Not recommended for scalable sites</p>
  1. Create a styles.css file and link it to your index.html.
  2. Set a custom background color and font family for the <body>.