How to CSS

How to CSS ka matlab hai HTML page me CSS ko add karna taaki hum design aur styling control kar sakein.

Jab browser CSS file ko read karta hai, to wo HTML elements ko uske according style kar deta hai.

CSS add karne ke 3 main tarike hote hain:

  • External CSS

  • Internal CSS

  • Inline CSS


1. External CSS

External CSS me styling ek alag .css file me likhi jati hai.

Iska fayda:
Ek hi file change karke poori website ka design change kar sakte ho.

HTML File Example

HTML File Example

CSS File (style.css)

CSS File (style.css)

Important:

  • CSS file ka extension .css hona chahiye

  • CSS file ke andar HTML tags nahi hote

  • 20px likhte hain, 20 px nahi


2. Internal CSS

Internal CSS tab use hota hai jab sirf ek page ko style karna ho

Ye <style> tag ke andar likha jata hai (head section me)

Example

Internal CSS

3. Inline CSS

Inline CSS ek single element ko style karne ke liye use hota hai.

Ye direct HTML tag ke andar style attribute se likha jata hai.

Example

Inline CSS

Multiple CSS & Priority (Cascading)

Agar ek hi element par multiple CSS apply ho rahi ho, to ek rule follow hota hai.

Example

how to

Agar external file me:

how to css

To final color hoga orange
kyunki internal CSS baad me likhi hai.


Cascading Order (Priority)

CSS me priority is order me hoti hai:

  1. Inline CSS (highest priority)

  2. Internal CSS

  3. External CSS

  4. Browser default (lowest)


Is tarah, How to CSS samajh kar aap easily decide kar sakte ho ki kaunsa method use karna hai aur apne web pages ko properly design kar sakte ho.

Leave a Comment