Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

CSS color

Colors are specified using predefined color names, or RGB, HEX, HSL, RGBA, HSLA values.


CSS Color

Explore the CSS colors, including traditional methods(RGB, hex) and modern approaches (HSL, HWB, LAB) for stunning, accessible designs.

CSS colors; Red, Green, Blue, Yellow, Gray, Black, Lime, Green, Olive etc.

You can use the color property to create colorful text with CSS. For Example, you can differentiate headings, links, and warnings by color.

The color property of CSS helps to set the color of the HTML elements. This helps to set the foreground color of text, text decorations, and borders.

CSS is used to style text color and the background color of elements. There are more involved aspects such as using gradients, but for now let's focus on the.

CSS & HTML colors: Explore CSS and HTML color properties, codes, and names to enhance your web design and create impactful user experiences.

CSS colors: There are several colors used in the CSS to enhance the representaion. The about of light an object emits at each visible wavelength.

CSS colors are used to style the color of HTML elementts. There are several ways to specify color in CSS.


CSS Background color

You can set the background color for HTML elements.

Example:
<h2 style="background-color:rgb(255,98,71);">Soopro Pathshala</h2>


CSS Text Color

You can set the color of text.

Example:
<h3 style="color:blue;">Soopro Pathshala</h3>


CSS Border Color

You can set the color of borders.

Example:
<h1 style="border:2px solid green;"> Soopro Pathshala <h1>


CSS color values

In CSS, colors can also be specified using RGB values, HEX values, HSL values, RGBA values, and HSLA values.

Example:
<h1 style="background-color:rgb(255,99,71);">...</h1>


Here are the main ways to specify colors in CSS

  • 1. Named Colors: CSS includes 140 named colors like red, blue, aqua, coral, etc.
  • 2. Hexadecial Colors:Hex color codes consist of # followed by three or six hexadecimal characters.
    • 3-digit Hex:#RGB
    • 6-digit Hex:#RRGGBB
  • 3. RGB (Red, Green, Blue) The rgb() function takes values for red, green, and blue channels(0-255).
  • 4. RGBA (Red, Green, Blue, Alpha) The rgba() function adds an alpha channel for transparency (o for fully transparent, 1 for fully opaque).
  • 5. HSL (Hue, Saturation, Lightness) The hsl() function sets hue (0-360), saturation (0%- 100%), and lightness (0%-100%).
  • 6. HSLA (Hue, Saturation, Lightness, Alpha The hsla() function adds an alpha channel for transparency.
  • 6. No Nesting: CSS does not support nested comments, Each comment block must be closed individually, or it may cause errors.
  • 7. CSS color Level 4: color Function CSS4 introduced a color() function for working with more advanced color spaces (eg., srgb, display-p3)