
CSS ka full form hai Cascading Style Sheets. Ye HTML elements ko style dene ka kaam karta hai – jaise ki color, font, size, layout wagaira.
Chaliye ab samajhte hain CSS ke 3 important parts:
1. Selectors
2. Colors
3. Fonts
Selectors bataate hain ki aap kaunse HTML element ko style karna chahte ho.
Sabhi elements pe ek saath style apply karta hai.
Example:
* {
margin: 0;
padding: 0;
}
Specific tag ko style karta hai.
Example:
h1 {
color: red;
}
Jis element mein wo class ho, usko style karta hai.
Example:
.box {
background-color: lightblue;
}
Ek unique element ko style karta hai.
Example:
#header {
font-size: 24px;
}
Ek hi style multiple elements ko dena ho to use hota hai.
Example:
h1, p {
text-align: center;
}
div
ke andar wale p
tag ko target karta hai.
Example:
div p {
color: green;
}
CSS mein aap alag-alag tarike se color define kar sakte ho.
Example:
h1 {
color: blue;
}
Example:
p {
color: #ff5733; /* orange-red jaisa color */
}
Example:
div {
background-color: rgb(255, 0, 0); /* red */
}
section {
background-color: rgba(0, 255, 0, 0.5); /* green with 50% transparency */
}
Example:
body {
color: hsl(200, 100%, 50%);
}
Text ka font website ki feel aur readability dono pe effect daalta hai.
Example:
body {
font-family: ‘Arial’, sans-serif;
}
Fallback fonts ka use karo taaki agar pehla load na ho to doosra ho jaye.
Example:
h2 {
font-size: 28px;
}
Example:
p {
font-weight: bold; /* ya 400, 700 jaisa number bhi chalega */
}
Example:
em {
font-style: italic;
}
h1 {
text-transform: uppercase;
}
Techy Notes पर पाएँ आसान हिंदी में computer notes in hindi और IT company interview questions, जिससे तैयारी हो असरदार और आसान हर छात्र के लिए।
© 2024 Created By Himanshu Nigam