Skip to main content
D
HTML
HTML Colors

HTML Colors

HTML colors define the visual color of elements.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

HTML applies colors using names, HEX values, or RGB values. Developers mostly control colors through CSS rather than plain HTML. Browsers support standard color names like red, blue, or transparent.

Syntax

Syntax
1<!-- NOTE: reference file does not cover colors fully — placeholder used -->
2<p style="color: red;">Red text</p>

Example

Example
1<!-- this sets inline colors -->
2<!DOCTYPE html>
3<html lang="en">
4  <head>
5    <meta charset="UTF-8">
6    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7    <title>Colors</title>
8  </head>
9  <body>
10    <h1 style="color: blue;">Blue Heading</h1>
11    <p style="background-color: black; color: white;">Dark mode</p>
12  </body>
13</html>

Try it Yourself

Hands-on Practice
Modify the code below to see how it affects the output. This is the best way to learn!
Interactive Editor
1234567891011121314151617181920
Live Preview

Key Points

  • HTML supports standard color names.
  • HEX and RGB values offer precise colors.
  • CSS handles most color styling.
  • Inline styles apply colors directly.

Up Next

Continue your journey with the next topic.

Go to HTML CSS