← Back to CSS Course | Chapter 12: Responsive Design | Lesson 8 of 8

CSS RWD Frameworks

एक responsive framework raw lumber से custom shelves बनाने के मुकाबले एक prefabricated shelving kit जैसा है -- assemble करने में तेज़ और consistently sturdy, इस कीमत पर कि इसे किसी और की shelves जैसा न दिखाना मुश्किल है।
Syntax
css
/* e.g. Bootstrap */
.container { }
.row { }
.col-md-6 { }

एक Responsive Framework क्या Provide करता है

Bootstrap और Tailwind जैसे frameworks इस course में कहीं और covered fluid-layout, flexible-media, और media-query fundamentals को grid classes, breakpoint utilities, और components के एक ready-made, pre-tested system में package कर देते हैं, ताकि किसी team को हर project में वही responsive plumbing हाथ से न बनानी पड़े।

उदाहरण: What a Responsive Framework Provides

css
<style>
.container { background: #e7f1ff; border: 2px solid #0d6efd; padding: 1rem; }
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<div class="container">Pre-built grid, breakpoints, and components</div>

Bootstrap-Style Grid Systems

Bootstrap की grid इस course के अपने 12-column layout topic में सिखाए गए उसी 12-column, fluid-percentage idea पर काम करती है, लेकिन इसे named breakpoints के एक fixed set से जुड़ी reusable classes (col-md-6, col-lg-4) के रूप में ship करती है, किसी बड़ी team या codebase में consistency के लिए कुछ flexibility trade करते हुए।

Note:
  • Accepted values:
  • container — width को center और limit करता है
  • row — columns के लिए एक flex row
  • col-<n> — 12 में से column span
  • col-md-<n> — md breakpoint से column span

उदाहरण: Bootstrap-style Grid Systems

css
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>
.col-md-6:nth-child(1) { background: lightblue; }
.col-md-6:nth-child(2) { background: lightgreen; }
</style>
<div class="row">
  <div class="col-md-6">Half width on medium+</div>
  <div class="col-md-6">Half width on medium+</div>
</div>

Utility-First Frameworks

Tailwind CSS एक अलग approach अपनाता है -- pre-built components के बजाय, यह छोटी single-purpose utility classes (flex, md:grid-cols-3) expose करता है जो इस course में covered raw CSS properties से लगभग सीधे map होती हैं, आपको अलग CSS files लिखे बिना HTML में responsive behavior compose करने देते हुए।

Note:
  • Accepted values:
  • flex — display: flex
  • md:grid — md breakpoint से display: grid लागू करता है
  • md:grid-cols-3 — md से तीन columns
  • gap-<n> — spacing utilities

उदाहरण: Utility-First Frameworks

css
<style>
.flex { display: flex; }
</style>
<script src="https://cdn.tailwindcss.com"></script>
<div class="flex md:grid md:grid-cols-3 gap-2">
  <div class="bg-blue-200 border-2 border-blue-500 p-2">One</div>
  <div class="bg-blue-200 border-2 border-blue-500 p-2">Two</div>
  <div class="bg-blue-200 border-2 border-blue-500 p-2">Three</div>
</div>

एक Framework कब अपनाने लायक है

एक framework बड़े team projects पर अपनी कीमत कमाता है जहाँ consistency और speed पूरी तरह custom look से ज़्यादा मायने रखते हैं, या जब किसी project को बिना शुरू से बनाए battle-tested cross-browser component behavior (जैसे एक accessible dropdown या modal) चाहिए।

उदाहरण: When a Framework Is Worth Adopting

css
<style>
body { padding: 1rem; }
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle">Battle-tested dropdown</button>
</div>

Hand-Rolled CSS कब बेहतर Choice है

छोटे projects, highly custom designs, या performance-critical pages के लिए, किसी framework का extra CSS/JS weight और generic visual defaults फ़ायदे के बजाय एक net cost हो सकते हैं।

raw fluid-layout/media-query fundamentals को समझना (जैसा इस पूरे course में सिखाया गया है) ही आपको यह decision default रूप से किसी framework की तरफ़ जाने के बजाय जानबूझकर लेने देता है।

उदाहरण: When Hand-Rolled CSS Is the Better Choice

css
<style>
.card {
  display: flex;
  gap: 10px;
  background: #f5f5f5;
  padding: 10px;
  border: 1px solid #ddd;
}
</style>
<div class="card">Small, custom project: no framework weight needed</div>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. एक छोटे page के लिए पूरी framework load करना, जो unused CSS जोड़ता है।
  2. framework के options इस्तेमाल करने के बजाय framework styles को ज़्यादा से ज़्यादा custom CSS से override करना।
  3. ज़रूरी container या row के बिना framework की grid classes इस्तेमाल करना।
चैप्टर सारांश
  • Responsive design pages को अलग-अलग devices के हिसाब से adapt कराता है, और viewport setting ज़रूरी है।
  • Grid views और media queries screen conditions के आधार पर layouts बदलते हैं।
  • Responsive images, videos, और frameworks content को किसी भी screen में fit होने में मदद करते हैं।
🔒

Chapter Quiz — Complete all 8 topics to unlock

0/8 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.