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

Background color

Background color Bad Practice
Background color Best Practice

Let's say you need to put some colored background beneath your text. Here comes another CSS property — the background-color. The syntax is the same as that of the text color property: style="background-color:powderblue;". Instead of powderblue value, you can insert any color name or its RGB, HSL, HEX, RGBA, or HSLA value.

Pro Tip: Don't forget to meet accessibility requirements and maintain the contrast ratio of 4.5:1 for normal-sized text and its background and 3:1 for larger text such as headings.

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