Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

css
color
font color
html
css font color

How do you change the font color using CSS?

Educative Answers Team

In CSS, we use the color property to set the foreground color of the text content for an element.

svg viewer

The code snippet below shows the syntax of using the color property to set the color of the <h1> element.

The value of the color property can be specified in three ways:

  1. Using RGB values e.g. rgb(250,0,0), rgb(0,250,0), etc.
  2. Using a Hexadecimal(HEX) value e.g. #FFFFFF, #000000, etc.
  3. Using a valid color name e.g. “white”, “red”, “black”, “blue”, etc.

In the code snippet above, a valid color name is used to set the color for <h1>. In case of <h3>, rgb values are used and a HEX value is used to set the color for the <p> tag.

RELATED TAGS

css
color
font color
html
css font color
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring