🎨 CSS की सभी बेसिक Concepts को आसान हिंदी में समझिए
अगर आप वेब डेवलपमेंट की शुरुआत कर रहे हैं, तो HTML के बाद अगला सबसे ज़रूरी स्टेप है CSS (Cascading Style Sheets)। यह आपके पेज को सुंदर, responsive और यूज़र फ्रेंडली बनाता है। इस लेख में हम CSS के सभी मुख्य कॉन्सेप्ट्स को सरल हिंदी भाषा में समझेंगे।
🧱 1. CSS का Structure
selector {
property: value;
}
📌 Selector बताता है किस HTML एलिमेंट को स्टाइल देना है, और property-value उसका डिज़ाइन बताता है।
h1 {
color: blue;
font-size: 32px;
}
🎨 2. Colors (रंग)
CSS में आप नाम (red), hex (#ff0000), RGB, और RGBA जैसे कई तरीके से रंग दे सकते हैं।
background-color: #f0f0f0;
color: rgba(0, 0, 0, 0.8);
📏 3. Units (माप की इकाइयाँ)
px– Pixels (फिक्स्ड साइज)em– Parent पर आधारितrem– Root पर आधारित%– Parent के अनुपात में
p {
font-size: 1.2rem;
width: 80%;
}
🧱 4. Box Model
हर HTML एलिमेंट में ये चार लेयर होती हैं:
| Margin |
| Border |
| Padding |
| Content |
div {
padding: 10px;
border: 1px solid #000;
margin: 20px;
}
🧩 5. Display Property
| Value | Description |
|---|---|
block |
पूरी row लेता है |
inline |
content जितनी जगह लेता है |
inline-block |
inline + block दोनों जैसा व्यवहार |
none |
एलिमेंट दिखता नहीं |
🧭 6. Positioning
| Type | काम करता है |
|---|---|
static |
डिफ़ॉल्ट behavior |
relative |
अपने position से shift होता है |
absolute |
nearest positioned ancestor के हिसाब से |
fixed |
हमेशा एक ही position पर रहता है |
sticky |
scroll के अनुसार चिपक जाता है |
📐 7. Flexbox
Flexbox layout से आप responsive और डायनामिक layouts बना सकते हैं।
.container {
display: flex;
justify-content: space-between;
align-items: center;
}
Common Properties:
flex-direction: row / columnjustify-content: center / space-betweenalign-items: center / flex-start / flex-end
📦 8. Grid Layout
CSS Grid एक two-dimensional layout सिस्टम है।
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
💅 9. Fonts & Text Styling
h1 {
font-family: Arial, sans-serif;
font-size: 24px;
font-weight: bold;
text-align: center;
text-transform: uppercase;
}
🎯 10. Borders & Shadows
.card {
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
🧪 11. Pseudo-classes & Pseudo-elements
a:hover {
color: red;
}
p::first-letter {
font-size: 200%;
}
📱 12. Media Queries (Responsive Design)
@media (max-width: 600px) {
body {
background-color: lightblue;
}
}
📌 Media queries आपको mobile-friendly design बनाने में मदद करते हैं।
🎨 13. Backgrounds
body {
background-color: #fff;
background-image: url("bg.png");
background-size: cover;
}
🌀 14. Transitions & Animations
button {
transition: background-color 0.3s ease;
}
Animation:
@keyframes slideIn {
from {
transform: translateX(-100%);
}
to {
transform: translateX(0);
}
}
.box {
animation: slideIn 1s ease-in-out;
}
🔗 15. Linking External CSS
<link rel="stylesheet" href="styles.css" />
📌 हमेशा external CSS का उपयोग करें ताकि कोड साफ़ और reusable रहे।
✅ निष्कर्ष
| Concept | Description |
|---|---|
| Selector | Target HTML element |
| Property | CSS स्टाइल (जैसे color, font) |
| Units | px, em, rem, % |
| Box Model | margin, border, padding, content |
| Display | Layout control |
| Position | Element placement control |
| Flex/Grid | Responsive layout |
| Media Queries | मोबाइल के लिए डिजाइन |
| Animation | Smooth UI experience |
🚀 प्रैक्टिस कैसे करें?
- छोटे UI Components बनाएं: Card, Navbar, Footer
- Chrome DevTools से स्टाइल बदलें और समझें
- Daily 1-2 mini CSS Projects करें
✍️ लेखक: सिद्धार्थ जैन 📅 प्रकाशन तिथि: 2 अगस्त 2025