Backgrounds in CSS

Backgrounds in CSS ka use element ke background me images ya colors apply karne ke liye hota hai.


Multiple Backgrounds in CSS

CSS multiple background images allow karta hai ek hi element par.

Images comma se separate hoti hain aur first image sabse upar dikhti hai.

Example

Backgrounds in CSS

Shorthand Example

Shorthand Example

Backgrounds in CSS Size

background-size property image ka size define karta hai.

Ye pixels, percentages ya keywords (auto, contain, cover) me set ho sakta hai.

Example

CSS Background Size

background-size Values

  • auto → default size
  • contain → image ko fit karta hai container ke andar
  • cover → pura container fill karta hai

Example

background-size Values

Multiple Background Size

Multiple backgrounds ke liye alag-alag sizes bhi define kar sakte hain.

Example

Multiple Background Size

Full Size Background Image

Full page background ke liye image ko pura viewport cover karna chahiye.

Example

Full Size Background Image

CSS Hero Image

Hero image ek large background image hoti hai jisme text bhi hota hai.

Example

CSS Hero Image

Backgrounds in CSS Origin

background-origin define karta hai ki background image kahan se start hogi.

Values:

  • padding-box (default)
  • border-box
  • content-box

Example

Backgrounds in CSS Origin

CSS Background Clip

background-clip define karta hai background kitni area tak dikhega.

Values:

  • border-box (default)
  • padding-box
  • content-box

Example (Image)

Example (Image)

Example (Color)

Example (Color)

Backgrounds in CSS se hum images aur colors ko customize kar sakte hain. Multiple backgrounds, sizing, aur positioning use karke designs ko visually attractive aur responsive banaya ja sakta hai.

Leave a Comment