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 sets or returns the color of the text.
Property | |||||
---|---|---|---|---|---|
color | Yes | Yes | Yes | Yes | Yes |
Return the color property:
Set the color property:
Value | Description |
---|---|
color | Specifies the color of the text. Look at CSS Color Values for a complete list of possible color values |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Default Value: | not specified |
---|---|
Return Value: | A String, representing the text-color of an element |
CSS Version | CSS1 |
Return the text-color of a <p> element:
alert(document.getElementById("myP").style.color);
CSS tutorial: CSS Text
CSS reference: color property