UGC-NET, GATE, NIELIT (O/A/B Level), KVS/NVS Computer Teacher, PGDCA, BCA, MCA, B-Tech व All India IT Exam विशेष नोट्स: इस अध्याय में हम Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks (टेलविंड CSS (Tailwind) बनाम बूटस्ट्रैप: यूटिलिटी-फर्स्ट अप्रोच) की संपूर्ण थ्योरी, मुख्य तकनीकी बिंदु, तुलनात्मक तालिका और राष्ट्रीय स्तर की परीक्षाओं के पैटर्न पर आधारित 20 अति-महत्वपूर्ण बहुविकल्पीय प्रश्न (MCQs) विस्तृत हिंदी व अंग्रेजी व्याख्या सहित पढ़ेंगे।
Overview: Tailwind CSS and Bootstrap represent two contrasting front-end styling paradigms: utility-first atomic classes versus pre-styled component frameworks. Understanding their architecture, bundle optimization (JIT/Purge vs Sass), responsive breakpoints, and customization workflows is vital for modern web engineering.
अध्याय सार: Tailwind CSS और Bootstrap फ्रंट-एंड स्टाइलिंग के दो विपरीत तरीकों का प्रतिनिधित्व करते हैं: यूटिलिटी-फर्स्ट एटॉमिक क्लासेस बनाम प्री-स्टाइल्ड कंपोनेंट फ्रेमवर्क। आधुनिक वेब इंजीनियरिंग के लिए इनके आर्किटेक्चर, बंडल ऑप्टिमाइजेशन (JIT/Purge बनाम Sass), रिस्पॉन्सिव ब्रेकपॉइंट्स और कस्टमाइजेशन को समझना जरूरी है।
Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks: Detailed Notes & Architecture (टेलविंड CSS (Tailwind) बनाम बूटस्ट्रैप: यूटिलिटी-फर्स्ट अप्रोच)
1. Utility-First vs Component-Based Architecture (यूटिलिटी-फर्स्ट बनाम कंपोनेंट-आधारित आर्किटेक्चर)
[EN] Bootstrap provides ready-made UI components (.btn, .card, .navbar, .modal) with opinionated visual defaults for rapid prototyping. Tailwind CSS provides low-level single-purpose utility classes (flex, p-4, text-slate-800) so developers compose custom designs directly in HTML without writing custom CSS.
[HI] Bootstrap त्वरित प्रोटोटाइपिंग के लिए .btn, .card, .navbar और .modal जैसे तैयार UI कंपोनेंट देता है। इसके विपरीत, Tailwind CSS लो-लेवल यूटिलिटी क्लासेस (flex, p-4, text-slate-800) प्रदान करता है ताकि डेवलपर कस्टम CSS लिखे बिना HTML में ही अनूठा डिज़ाइन बना सकें।
2. Grid System and Responsive Breakpoints (ग्रिड सिस्टम और रिस्पॉन्सिव ब्रेकपॉइंट्स)
[EN] Bootstrap 5 uses a 12-column Flexbox grid (.row, .col-md-6) with 6 breakpoints (xs, sm, md, lg, xl, xxl) and dropped jQuery in favor of vanilla JS. Tailwind uses mobile-first prefixes (sm:, md:, lg:, xl:, 2xl:) applicable to any utility, including native CSS Grid (grid-cols-12) and Flexbox.
[HI] Bootstrap 5 में 6 ब्रेकपॉइंट्स (xs, sm, md, lg, xl, xxl) के साथ 12-कॉलम फ्लेक्सबॉक्स ग्रिड है और इसने jQuery हटाकर वैनिला JS अपनाया है। Tailwind में मोबाइल-फर्स्ट प्रीफिक्स (sm:, md:, lg:, xl:, 2xl:) होते हैं जो CSS Grid और Flexbox की किसी भी यूटिलिटी पर लागू होते हैं।
3. JIT Engine, Tree-Shaking, and Bundle Size (JIT इंजन, ट्री-शेकिंग और बंडल साइज)
[EN] Tailwind CSS v3+ compiles CSS on-demand via its Just-In-Time (JIT) engine, scanning template files so production builds contain only the exact classes used (often under 10 KB gzipped). Bootstrap ships a larger compiled CSS/JS bundle unless developers manually import partial Sass modules.
[HI] Tailwind CSS v3+ अपने Just-In-Time (JIT) इंजन से केवल उपयोग की गई क्लासेस को ही प्रोडक्शन CSS में शामिल करता है, जिससे फाइल साइज अक्सर 10 KB से कम रहता है। Bootstrap का डिफ़ॉल्ट बंडल बड़ा होता है जब तक कि Sass मॉड्यूल को अलग से इम्पोर्ट न किया जाए।
4. Customization and Arbitrary Values (कस्टमाइजेशन और आर्बिट्रेरी वैल्यूज)
[EN] Bootstrap customization relies on overriding Sass variables ($primary, $border-radius) before compilation or using CSS custom properties (--bs-*). Tailwind customizes design tokens in tailwind.config.js (or @theme in v4) and supports on-the-fly arbitrary values using square brackets like w-[340px] or bg-[#1da1f2].
[HI] Bootstrap में कस्टमाइजेशन Sass वेरिएबल्स ($primary) या CSS वेरिएबल्स (--bs-*) को ओवरराइड करके किया जाता है। Tailwind में डिज़ाइन टोकन tailwind.config.js (या v4 में @theme) से बदलते हैं और w-[340px] जैसे स्क्वायर ब्रैकेट से तुरंत आर्बिट्रेरी वैल्यू दी जा सकती है।
Syntax, Formula & Technical Example (Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks)
<!-- Bootstrap 5 Card Component -->
<div class="card shadow-sm p-3 mb-3">
<button class="btn btn-primary">Submit</button>
</div>
<!-- Equivalent Tailwind CSS Utility-First Markup -->
<div class="rounded-lg bg-white p-4 shadow-sm border">
<button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">Submit</button>
</div>
Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks Quick Reference & Comparison Table
| Aspect | Tailwind CSS | Bootstrap 5 |
|---|---|---|
| Design Paradigm | Utility-first atomic classes | Pre-styled component classes |
| JavaScript Dependency | None (CSS-only framework) | Vanilla JS (Popper.js for dropdowns/tooltips) |
| Production Bundle | JIT tree-shaken (~5-15 KB gzipped) | Full CSS ~25 KB+ unless Sass-trimmed |
| Default Breakpoint Base | sm starts at 640px (mobile-first) | sm starts at 576px (12-col grid) |
Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks Top 20 Bilingual MCQs with Answers
Q1. Which CSS framework is primarily classified as a 'utility-first' framework?
(किस CSS फ्रेमवर्क को मुख्य रूप से 'यूटिलिटी-फर्स्ट' (utility-first) फ्रेमवर्क के रूप में वर्गीकृत किया जाता है?)
(A) Foundation
(B) Bootstrap 5
(C) Bulma
(D) Tailwind CSS
Correct Answer: (D)
[EN] Tailwind CSS provides atomic utility classes like flex, pt-4, and text-center rather than pre-built UI components.
[HI] Tailwind CSS प्री-बिल्ट कंपोनेंट्स के बजाय flex, pt-4 जैसी एटॉमिक यूटिलिटी क्लासेस प्रदान करता है।
Q2. Which major JavaScript library dependency was completely removed in Bootstrap 5?
(Bootstrap 5 में किस प्रमुख जावास्क्रिप्ट लाइब्रेरी की निर्भरता को पूरी तरह हटा दिया गया था?)
(A) Lodash
(B) jQuery
(C) Popper.js
(D) React
Correct Answer: (B)
[EN] Bootstrap 5 replaced jQuery with vanilla JavaScript while retaining Popper.js for tooltips and dropdowns.
[HI] Bootstrap 5 ने jQuery को हटाकर वैनिला जावास्क्रिप्ट को अपनाया, जबकि टूलटिप्स के लिए Popper.js को रखा।
Q3. How does Tailwind CSS v3+ keep production CSS bundle sizes minimal?
(Tailwind CSS v3+ प्रोडक्शन CSS बंडल के आकार को न्यूनतम कैसे रखता है?)
(A) JIT (Just-In-Time) engine scans templates and generates only used classes
(B) It loads styles from a mandatory CDN at runtime
(C) It compresses images into CSS
(D) It disables responsive breakpoints
Correct Answer: (A)
[EN] Tailwind's JIT compiler parses source files and outputs only the utility classes actually referenced in markup.
[HI] Tailwind का JIT कंपाइलर सोर्स फाइलों को स्कैन करता है और केवल उपयोग की गई यूटिलिटी क्लासेस ही जनरेट करता है।
Q4. How many columns does Bootstrap's standard responsive grid system use?
(Bootstrap का मानक रिस्पॉन्सिव ग्रिड सिस्टम कितने कॉलम का उपयोग करता है?)
(A) 16
(B) 12
(C) 8
(D) 10
Correct Answer: (B)
[EN] Bootstrap uses a 12-column grid because 12 is evenly divisible by 1, 2, 3, 4, and 6.
[HI] Bootstrap 12-कॉलम ग्रिड का उपयोग करता है क्योंकि 12 को 1, 2, 3, 4 और 6 से समान रूप से विभाजित किया जा सकता है।
Q5. In Tailwind CSS, which syntax allows applying a custom one-off pixel width like 327px without editing config?
(Tailwind CSS में कॉन्फ़िग को एडिट किए बिना 327px जैसी कस्टम एक-बार की चौड़ाई लागू करने के लिए किस सिंटैक्स का उपयोग होता है?)
(A) w:327px
(B) w-{327px}
(C) w-[327px]
(D) w-(327px)
Correct Answer: (C)
[EN] Square brackets indicate arbitrary values in Tailwind's JIT engine, e.g., w-[327px] or bg-[#ff0055].
[HI] Tailwind के JIT इंजन में स्क्वायर ब्रैकेट [ ] आर्बिट्रेरी वैल्यू को दर्शाते हैं, जैसे w-[327px]।
Q6. In Tailwind CSS, what does the 'md:' prefix in 'md:flex-row' signify?
(Tailwind CSS में 'md:flex-row' में 'md:' प्रीफिक्स क्या दर्शाता है?)
(A) Apply flex-row only on dark mode
(B) Apply flex-row on mouse hover
(C) Apply flex-row at viewport width >= 768px (mobile-first)
(D) Apply flex-row only on mobile screens < 768px
Correct Answer: (C)
[EN] Tailwind breakpoints are mobile-first min-width media queries; md: applies at >= 768px.
[HI] Tailwind ब्रेकपॉइंट्स मोबाइल-फर्स्ट min-width मीडिया क्वेरी हैं; md: >= 768px पर लागू होता है।
Q7. Which CSS preprocessor is used internally by Bootstrap 5 for its source stylesheets?
(Bootstrap 5 द्वारा अपनी सोर्स स्टाइलशीट के लिए आंतरिक रूप से किस CSS प्रीप्रोसेसर का उपयोग किया जाता है?)
(A) Stylus
(B) PostCSS only
(C) Sass (SCSS)
(D) Less
Correct Answer: (C)
[EN] Bootstrap switched from Less (v3) to Sass/SCSS in v4 and v5.
[HI] Bootstrap ने v4 और v5 में अपनी सोर्स स्टाइलशीट के लिए Sass (SCSS) का उपयोग किया है।
Q8. What happens if you dynamically construct a Tailwind class name in JS like `'bg-' + color + '-500'`?
(यदि आप JS में `'bg-' + color + '-500'` की तरह डायनामिक रूप से Tailwind क्लास का नाम बनाते हैं तो क्या होगा?)
(A) The browser throws a SyntaxError
(B) Tailwind's static scanner may miss it and omit the class from production CSS
(C) Tailwind automatically compiles all 10,000 color combinations
(D) Bootstrap overrides the class
Correct Answer: (B)
[EN] Tailwind scans source files statically for complete class strings, so dynamic string concatenation breaks tree-shaking.
[HI] Tailwind सोर्स फाइलों को स्टैटिक रूप से स्कैन करता है, इसलिए डायनामिक स्ट्रिंग जोड़ने पर वह क्लास प्रोडक्शन CSS से छूट सकती है।
Q9. Which Bootstrap 5 breakpoint was newly added beyond Bootstrap 4's xl breakpoint?
(Bootstrap 4 के xl ब्रेकपॉइंट के बाद Bootstrap 5 में कौन सा नया ब्रेकपॉइंट जोड़ा गया था?)
(A) 4k (>= 2560px)
(B) hd (>= 1080px)
(C) xxl (>= 1400px)
(D) xxs (< 320px)
Correct Answer: (C)
[EN] Bootstrap 5 introduced the xxl breakpoint at >= 1400px for extra-extra-large screens.
[HI] Bootstrap 5 ने बहुत बड़ी स्क्रीन (>= 1400px) के लिए xxl ब्रेकपॉइंट जोड़ा।
Q10. Which Tailwind CSS directive or prefix applies styles only when a user hovers over an element?
(Tailwind CSS में कौन सा प्रीफिक्स केवल तब स्टाइल लागू करता है जब यूजर किसी एलिमेंट पर होवर (hover) करता है?)
(A) hover:
(B) focus:
(C) :hover-
(D) onhover:
Correct Answer: (A)
[EN] State variants in Tailwind use colon prefixes such as hover:bg-blue-700 and focus:ring-2.
[HI] Tailwind में स्टेट वेरिएंट कोलन प्रीफिक्स का उपयोग करते हैं जैसे hover:bg-blue-700।
Q11. Does Tailwind CSS ship interactive JavaScript components like modals and carousels out of the box?
(क्या Tailwind CSS बॉक्स से बाहर (out of the box) मोडल और कैरोसेल जैसे इंटरैक्टिव जावास्क्रिप्ट कंपोनेंट देता है?)
(A) Yes, via tailwind.bundle.js
(B) Yes, via Bootstrap's Popper
(C) No, Tailwind is CSS-only and requires separate JS or libraries like Headless UI
(D) Yes, using built-in jQuery
Correct Answer: (C)
[EN] Tailwind only generates CSS; interactive behavior is handled with custom JS, Alpine.js, or Headless UI.
[HI] नहीं, Tailwind केवल CSS फ्रेमवर्क है; इंटरैक्टिव व्यवहार के लिए अलग JS या Headless UI की आवश्यकता होती है।
Q12. In Bootstrap 5, which CSS class creates a full-width container spanning 100% of the viewport?
(Bootstrap 5 में कौन सी CSS क्लास व्यूपोर्ट की 100% चौड़ाई वाला फुल-विड्थ कंटेनर बनाती है?)
(A) .container-100
(B) .container-full
(C) .container-fluid
(D) .container-wide
Correct Answer: (C)
[EN] .container-fluid spans 100% width across all breakpoints, unlike fixed-max-width .container.
[HI] .container-fluid सभी ब्रेकपॉइंट्स पर 100% चौड़ाई लेता है।
Q13. In Tailwind CSS, which @apply directive usage allows extracting repeated utility combinations into a custom CSS class?
(Tailwind CSS में दोहराए जाने वाले यूटिलिटी कॉम्बिनेशन को कस्टम CSS क्लास में निकालने के लिए किस डायरेक्टिव का उपयोग होता है?)
(A) @apply
(B) @mixin
(C) @import
(D) @extend
Correct Answer: (A)
[EN] @apply lets you inline existing Tailwind utilities inside a custom CSS selector, e.g., .btn { @apply px-4 py-2 rounded; }.
[HI] @apply आपको कस्टम CSS सिलेक्टर के अंदर Tailwind यूटिलिटीज को इनलाइन करने की अनुमति देता है।
Q14. Which CSS custom property prefix did Bootstrap 5 adopt for runtime theming?
(Bootstrap 5 ने रनटाइम थीमिंग के लिए किस CSS कस्टम प्रॉपर्टी प्रीफिक्स को अपनाया?)
(A) --bs-
(B) --tw-
(C) --css-
(D) --bt-
Correct Answer: (A)
[EN] Bootstrap 5 exposes CSS variables prefixed with --bs- (e.g., --bs-primary, --bs-body-bg).
[HI] Bootstrap 5 --bs- प्रीफिक्स वाले CSS वेरिएबल्स (जैसे --bs-primary) का उपयोग करता है।
Q15. Which framework is generally faster for building an admin dashboard with standard UI widgets when no custom brand design exists?
(जब कोई कस्टम ब्रांड डिज़ाइन न हो, तो मानक UI विजेट्स के साथ एडमिन डैशबोर्ड बनाने के लिए आमतौर पर कौन सा फ्रेमवर्क तेज होता है?)
(A) Normalize.css
(B) Tailwind CSS
(C) Bootstrap
(D) Pure CSS Reset
Correct Answer: (C)
[EN] Bootstrap's pre-built components (tables, modals, navbars, forms) allow immediate assembly without designing from scratch.
[HI] Bootstrap के तैयार कंपोनेंट्स (टेबल, मोडल, नैवबार) बिना स्क्रैच से डिज़ाइन किए तुरंत डैशबोर्ड बनाने में तेज होते हैं।
Q16. Which of the following statements about Tailwind CSS and Bootstrap is NOT true?
(Tailwind CSS और Bootstrap के बारे में निम्नलिखित में से कौन सा कथन सत्य नहीं है?)
(A) Tailwind CSS requires Bootstrap's 12-column .row and .col classes to build responsive layouts
(B) Tailwind CSS uses a mobile-first breakpoint system
(C) Bootstrap 5 includes built-in JavaScript plugins for modals and dropdowns
(D) Bootstrap 5 uses Sass variables for compile-time customization
Correct Answer: (A)
[EN] Tailwind CSS is completely independent of Bootstrap and uses its own Flexbox and CSS Grid utilities (flex, grid-cols-*).
[HI] Tailwind CSS पूरी तरह से Bootstrap से स्वतंत्र है और लेआउट के लिए अपनी Flexbox तथा CSS Grid यूटिलिटीज का उपयोग करता है।
Q17. Within Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks, which aspect directly maps to: "Utility-first atomic classes"?
(Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks में कौन सा Aspect सीधे "Utility-first atomic classes" से संबंधित है?)
(A) Default Breakpoint Base
(B) Design Paradigm
(C) Production Bundle
(D) JavaScript Dependency
Correct Answer: (B)
[EN] In Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks, 'Design Paradigm' handles 'Utility-first atomic classes' (Pre-styled component classes).
[HI] Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks में 'Design Paradigm' का कार्य/विवरण 'Utility-first atomic classes' (Pre-styled component classes) है।
Q18. Which option accurately describes 'JavaScript Dependency' in Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks?
(Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks के संदर्भ में 'JavaScript Dependency' की सही विशेषता कौन सी है?)
(A) None (CSS-only framework)
(B) sm starts at 640px (mobile-first)
(C) JIT tree-shaken (~5-15 KB gzipped)
(D) Utility-first atomic classes
Correct Answer: (A)
[EN] 'JavaScript Dependency' provides 'None (CSS-only framework)' — key point: Vanilla JS (Popper.js for dropdowns/tooltips).
[HI] 'JavaScript Dependency' का मुख्य विवरण 'None (CSS-only framework)' है (Vanilla JS (Popper.js for dropdowns/tooltips))।
Q19. In Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks, identify the correct parameter for the specification: "JIT tree-shaken (~5-15 KB gzipped)".
(Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks में "JIT tree-shaken (~5-15 KB gzipped)" विवरण किस विकल्प के लिए सही है?)
(A) JavaScript Dependency
(B) Production Bundle
(C) Default Breakpoint Base
(D) Design Paradigm
Correct Answer: (B)
[EN] 'Production Bundle' corresponds to 'JIT tree-shaken (~5-15 KB gzipped)' (Full CSS ~25 KB+ unless Sass-trimmed).
[HI] 'Production Bundle' का संबंध 'JIT tree-shaken (~5-15 KB gzipped)' (Full CSS ~25 KB+ unless Sass-trimmed) से है।
Q20. Considering Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks, what key behavior defines 'Default Breakpoint Base'?
(Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks में 'Default Breakpoint Base' की मुख्य भूमिका या मान क्या है?)
(A) None (CSS-only framework)
(B) JIT tree-shaken (~5-15 KB gzipped)
(C) Utility-first atomic classes
(D) sm starts at 640px (mobile-first)
Correct Answer: (D)
[EN] 'Default Breakpoint Base' represents 'sm starts at 640px (mobile-first)' (sm starts at 576px (12-col grid)).
[HI] 'Default Breakpoint Base' का अर्थ/मान 'sm starts at 640px (mobile-first)' है (sm starts at 576px (12-col grid))।
Tailwind CSS vs Bootstrap: Utility-First vs Component Frameworks — Exam FAQs
Q1: Can Tailwind CSS and Bootstrap be used together in the same project?
क्या Tailwind CSS और Bootstrap को एक ही प्रोजेक्ट में साथ उपयोग किया जा सकता है?
[EN] It is technically possible by adding a prefix (e.g., tw-) in Tailwind config, but discouraged because it increases CSS payload and causes class conflicts.
[HI] तकनीकी रूप से Tailwind कॉन्फ़िग में प्रीफिक्स (जैसे tw-) जोड़कर ऐसा संभव है, लेकिन इससे CSS साइज बढ़ता है और क्लासेस टकरा सकती हैं, इसलिए इसकी सलाह नहीं दी जाती।
Q2: Why do Tailwind HTML templates look verbose with many classes?
Tailwind HTML टेम्पलेट्स में इतनी अधिक क्लासेस क्यों दिखाई देती हैं?
[EN] Because styling is co-located directly on elements via atomic utilities rather than hidden in external CSS files; reusable UI components (React/Vue/Blade) keep it DRY.
[HI] क्योंकि स्टाइलिंग बाहरी CSS फाइल के बजाय सीधे एलिमेंट्स पर एटॉमिक क्लासेस से की जाती है; React/Vue कंपोनेंट्स से दोहराव कम हो जाता है।
Q3: Which framework has better performance in Core Web Vitals?
Core Web Vitals में किस फ्रेमवर्क का प्रदर्शन बेहतर होता है?
[EN] Tailwind CSS typically achieves smaller CSS payloads (~5-15 KB) via JIT tree-shaking, reducing render-blocking CSS download time compared to default Bootstrap.
[HI] Tailwind CSS JIT ट्री-शेकिंग के कारण बहुत छोटा CSS पेलोड (~5-15 KB) बनाता है, जिससे रेंडर-ब्लॉकिंग समय कम होता है।
Post a Comment
Post a Comment