css

CSS Colors

Colors can be specified using a variety of different methods. Some of the more common ways to specify colors are:

Named Colors – These are predefined color names supported by all web browsers, such as B. “red”, “blue”, “green”, etc.

Hexadecimal Colors: These are six-digit codes that represent a color using a combination of the letters A-F and the numbers 0-9. For example, #ff0000 is red, #0000ff is blue, and #000000 is black.

RGB Colors: These are colors specified by a combination of red, green, and blue values. For example, rgb(255, 0, 0) is red, rgb(0, 0, 255) is blue, and rgb(0, 0, 0) is black.

RGBA Colors: These are similar to RGB colors, but also contain an alpha channel value that can be used to specify the transparency of a color. For example, rgba(255, 0, 0, 0.5) is red at 50% opacity, and rgba(0, 0, 255, 1.0) is blue at full opacity.

HSL Colors: These are colors specified by a combination of hue, saturation, and lightness values. For example, hsl(0, 100%, 50%) is red, hsl(240, 100%, 50%) is blue, and hsl(0, 0%, 0%) is black.

HSLA Colors: These are similar to HSL Colors, but also contain an alpha channel value that can be used to indicate the transparency of a color.

CSS allows you to use these color values ​​in various properties like background color, color, border color, etc.

.sample-class {
  color: #4CAF50;
  background-color: hsla(120,100%,50%,0.5);
  border: 2px solid rgb(255,255,255);
}
Posts created 494

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top