Skip to content

HTML Tutorial HTML and CSS

External CSS: Linking a Stylesheet to Your Pages

Lesson 39 of 81 2 min read By Deepak Paswan Updated Oct 4, 2026

An external stylesheet is a separate .css file that many pages can share. This is the normal way to style a real website.

Step 1: create the file

Save this as styles.css:

styles.css
CSS
body {
  font-family: Georgia, serif;
  background: #fffbf9;
  color: #1c1b1f;
}
h1 { color: #b84624; }

Use the link element inside <head>:

index.html
HTML
<head>
  <meta charset="UTF-8">
  <title>Juniper Books</title>
  <link rel="stylesheet" href="styles.css">
</head>
  • rel="stylesheet" says what kind of file this is.
  • href is the path to it, just like a link.

Why it is the best option

  • Write the style once and use it on every page.
  • Change the design in one place.
  • Browsers can cache the file, so later pages load faster.

Using more than one stylesheet

You can link several. Later files override earlier ones when rules conflict.

lightbulb
Check the path
If styles do not apply, the href is the first thing to check. Open the browser’s developer tools and look at the Network tab to see if the file loaded.