HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Set the text-color for different elements
The color
property specifies the color of text.
Default value: | not specified |
---|---|
Inherited: | yes |
Animatable: | yes. Read about animatable Try it |
Version: | CSS1 |
JavaScript syntax: | object.style.color="#0000FF" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
color | 1.0 | 3.0 | 1.0 | 1.0 | 3.5 |
Value | Description | Demo |
---|---|---|
color | Specifies the text color. Look at CSS Color Values for a complete list of possible color values. | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Set the text color with a HEX value:
body {color: #92a8d1;}
Set the text color with an RGB value:
body {color: rgb(201, 76, 76);}
Set the text color with an RGBA value:
body {color: rgba(201, 76, 76, 0.6);}
Set the text color with a HSL value:
body {color: hsl(89, 43%, 51%);}
Set the text color with a HSLA value:
body {color: hsla(89, 43%, 51%, 0.6);}
CSS tutorial: CSS Text
HTML DOM reference: color property