Colors in CSS

Colors in CSS different formats me define kiye ja sakte hain jaise:

  • Color names (140+ supported)
  • HEX values
  • RGB values
  • RGBA values
  • HSL values
  • HSLA values
  • opacity

RGBA Colors

RGBA RGB ka extension hai jisme alpha channel hota hai jo opacity define karta hai colors in CSS par.

Syntax

Colors in CSS (RGBA)

Alpha value 0.0 (fully transparent) se 1.0 (fully opaque) ke beech hoti hai.

Example

RGBA Colors

HSLA Colors

HSLA HSL ka extension hai jisme alpha channel hota hai for opacity colors in CSS par.

Syntax

Colors in CSS (HSLA)

Alpha value 0.0 se 1.0 ke beech hoti hai.

Example

HSLA Colors

CSS Opacity Property

opacity property poore element ki transparency set karta hai colors in CSS par. (background + text dono).

Value 0.0 se 1.0 ke beech hoti hai.

Example

CSS Opacity Property

Note: Text bhi transparent ho jata hai.


CSS Color Keywords

CSS me kuch predefined keywords hote hain:

  • transparent
  • currentcolor
  • inherit

The transparent Keyword

transparent color ko fully transparent bana deta hai.

The transparent Keyword

Note: transparent = rgba(0,0,0,0)


The currentcolor Keyword

currentcolor element ke current text color ko use karta hai.

Example

The currentcolor Keyword
The currentcolor Keyword
The currentcolor Keyword

The inherit Keyword

inherit parent element se value inherit karta hai.

Example

The inherit Keyword

Colors in CSS different formats aur properties ke through control kiye ja sakte hain. RGBA aur HSLA opacity ke liye use hote hain, aur keywords jaise transparent aur currentcolor flexibility provide karte hain.

Leave a Comment