Course Content
Introduction
Introduction to CSS course
0/1
CSS Syntax
0/1
CSS Selectors
0/1
CSS Unit of Measurements
CSS units are used to specify measurements for various properties such as length, width, margin, padding, font size, and more.
0/1
CSS Colors
CSS provides various ways to specify colors.
0/2
CSS Properties And Values
0/1
CSS Background
0/1
CSS Box Model
0/1
CSS Display
CSS display property is used to control how an element is displayed on the webpage.
0/3
Typography and Font Properties
0/1
CSS Display And Positioning
0/2
Responsive Design with CSS Media Queries
0/1
About Lesson

 

CSS Colors Tutorial

1. Color Names:

Red
Blue
Green

2. Hexadecimal Notation:

#FF0000
#00FF00
#0000FF
#FFFFFF
#000000

3. RGB and RGBA Notation:

rgb(255, 0, 0)
rgb(255, 255, 0)
rgba(0, 0, 255)
rgba(0, 0, 0)
rgba(255, 255, 255)
rgba(255, 0, 0, 0.5)
rgba(255, 88, 60, 0.1)

4. HSL and HSLA Color Model:

HSL stands for Hue, Saturation, and Lightness, and it is a color model used in CSS to define colors. Here’s how HSL works:

Hue (H):

The hue represents the color itself and is measured in degrees on a color wheel. It ranges from 0 to 360, where 0 and 360 represent red, 120 represents green, and 240 represents blue. The hues in between create different colors.

Saturation (S):

The saturation represents the intensity or purity of the color. It is measured as a percentage from 0% to 100%. A saturation of 0% results in grayscale, while 100% provides full color intensity.

Lightness (L):

The lightness determines the overall lightness or darkness of the color. It is also measured as a percentage, ranging from 0% (black) to 100% (white). A lightness of 50% represents the color at its normal level of brightness.

Alpha value (A):

It represents the color’s transparency and it is specified as a number between 0 and 1, where 0 is fully transparent (completely see-through) and 1 is fully opaque (completely solid). By adjusting the alpha value, you can control the level of transparency for the color.

hsl(0, 100%, 50%)
hsl(120, 100%, 50%)
hsl(240, 100%, 50%)
hsla(0, 100%, 50%,0.8)
hsla(120, 100%, 50%,0.5)
hsla(240, 100%, 50%.0.1)

5. Custom Color Examples:

#FF8800
rgb(128, 64, 0)
rgba(0, 255, 0, 0.3)
hsl(240, 50%, 70%)
hsla(180, 100%, 25%, 0.8)