Which CSS property changes the text color?

The story behind the answer

Which CSS property changes the text color? The answer is color. In CSS, the color property sets an element’s foreground color, which normally means the color of its text. For example, `p { color: navy; }` makes paragraph text navy, while `h1 { color: #c00; }` applies a dark red color to headings.

The property accepts named colors such as `red`, hexadecimal values such as `#ff0000`, functional notations such as `rgb(255 0 0)`, and newer color formats including HSL and OKLCH. CSS separates this presentation rule from HTML’s document structure, so one rule can style many elements or pages.

A common mix-up is `background-color`, which changes the area behind the content rather than the text itself. `font-color` and `text-color` sound plausible but are not standard CSS property names. The color property is inherited by many descendant elements unless another rule overrides it, so setting it on `body` can establish a page-wide default. Good authors also check text-background contrast for accessibility.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: