In CSS, we use the color
property to set the foreground color of the text content for an element.
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:
RGB values
e.g. rgb(250,0,0), rgb(0,250,0), etc.Hexadecimal(HEX) value
e.g. #FFFFFF, #000000, etc.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.