HTML Color

HTML Color

HTML colors are specified with predefined color names, or with RGB, HEX, HSL, RGBA, or HSLA values.

Three types to give a CSS to HTML Document.

  • HEX
  • HSL and HSLA Colors
  • RGB and RGBA
HEX

A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color.

In HTML, a color can be specified using a hexadecimal value in the form.

#rrggbb

Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0-255).

Example

#5600ff

HSL and HSLA Colors

HSL stands for hue, saturation, and lightness, HSLA color values are an extension of HSL with an Alpha channel (opacity).

In HTML, a color can be specified using hue, saturation, and lightness (HSL) in the form:

hsl(hue, saturation, lightness)

Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0-255).

Example

hsl(243, 100%, 56%)

HSLA color values are an extension of HSL color values with an Alpha channel - which specifies the opacity for a color, An HSLA color value is specified with

In HTML, a color can be specified using hue, saturation, and lightness (HSL) in the form:

hsla(hue, saturation, lightness, alpha)

Example

hsla(220, 100%, 50%, 1)

RGB and RGBA Colors

An RGB color value represents RED, GREEN, and BLUE light sources.

In HTML, a color can be specified as an RGB value, using this formula:

rgb(red, green, blue)

Example

rgb(46, 15, 212)

An RGBA color value is an extension of RGB with an Alpha channel (opacity).

rgba(red, green, blue, alpha)

Example

rgba(36, 0, 147, 1)

Leave A Comment :