<?xml version="1.0" encoding="utf-8"?>

Text color

Text color Bad Practice
Text color Best Practice

By default, browsers display the entire text as black unless stated otherwise. To change your text color, add the attribute style to the text element tag, followed by an equals symbol (=), and use the property color.

There are 3 different ways you can set a color:

• By name — for example, "blue" or "crimson"

• By hex value — for example, #0000FF

• By RGB value — for example, rgb(0, 0, 255)

While there are over 140 color names that all browsers support,[1] a more professional approach is to use the hex or RGB values.

Top contributors

Mostafa Gaber

Topics

From Lesson

Share

Improve your UX & Product skills with interactive courses that actually work