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

Text color

Text color Bad Practice
Text color Best Practice

The style attribute helps us decorate HTML elements. How can the HTML attributes like style modify text color? For that purpose, we have a CSS color property. In the example, the attribute style="color:blue;" tells the browser that the element should be blue. The color here is a CSS property, while blue is its value.

Stick to the standard HTML and CSS syntax to display changes properly:

• An equals sign (=) after style

• A colon (:) to separate the two parts

• Quotation marks (" ") to wrap the color property

• A semicolon (;) after the CSS value

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