LESSON 03 OF 100

Use an internal stylesheet

Add a rule to the style element in head.

Official sourceW3C CSS Syntax — declarationsReviewed: 2026-08-26
STEP 1 · LEARN

How it works

The style element can contain CSS rules in the document. In this lesson it sits in head and selects the page heading.

Correct example
<style>h1 { color: #7c3aed; }</style>

The rule is immediately available to the document and colours every h1.

Common mistake
<style>h1 color: #7c3aed;</style>

The declaration must be inside a brace-delimited block after the selector.

STEP 2 · APPLY

Your exercise

Complete the h1 rule with the colour #7c3aed.

STEP 3 · BUILD

Write and see the result

index.htmlCSS
Safe resultisolated
The draft stays only in this browser.HTML and CSS allowed · scripts and network blocked
STEP 4 · CHECK

What needs to pass

0%not checked
  • The rule is in a style element inside head.
  • h1 receives the colour #7c3aed.
Explain the solution logic

The style element supplies the internal stylesheet; the h1 selector and valid declaration produce the result.