CSS color Property
Demo
CSS color Property
CSS color
property specifies the color of text.
Example
Syntax
Using CSS
Using Javascript
Animatable
Yes, color property is animatable. CSS Animatable Properties Reference.
Default Value
Default value for CSS color property is black.
Property Value
The following table provides a list of values for CSS color
property.
Value | Explanation |
---|---|
text | Specifies the name of the color in text. For example, black. |
hex | Specifies the name of the color in Hexadecimal value. For example, #000000 |
rgb | Specifies the name of the color in rgb(red, green, blue) value. For example, rgb(0, 0, 0) |
rgba | Specifies the name of the color in rgba(red, green, blue, opacity) value. For example, rgb(0, 0, 0, 0.5) |
hsl | Specifies the name of the color in hsl(hue, saturation, lightness) value. For example, hsl(0, 0%, 0%) |
hsla | Specifies the name of the color in hsla(hue, saturation, lightness, opacity) value. For example, hsl(0, 0%, 0%, 0.5) |
All in One
In the following example, we will demonstrate all values of CSS color
property.
Example
Using JavaScript
In the following example, we will demonstrate how to set the CSS color
property of an element using JavaScript.
Example
Reminder
Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in CSS.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.