TGViewer
Web Development Web Development @webdevcoursefree · 79.7K subscribers
Post #3307 7.06K
✅ CSS Fundamentals – Interview Questions & Answers 🎨🧠

1️⃣ What is the Box Model in CSS?
The box model describes how elements are rendered:
Content → Padding → Border → Margin
It affects spacing and layout.

2️⃣ What's the difference between ID and Class selectors?
⦁ #id: Unique, used once.
⦁ .class: Reusable across multiple elements.
Example:
#header { color: red; }.card { padding: 10px; }


3️⃣ How does CSS Specificity work?
Specificity decides which styles are applied when multiple rules target the same element.
Hierarchy:
Inline > ID > Class > Element
Example:
<p id="one" class="two">Text</p>
#one has higher specificity than .two.

4️⃣ What is Flexbox?
A layout model for 1D alignment (row or column).
Key properties:
⦁ display: flex
⦁ justify-content, align-items, flex-wrap

5️⃣ Difference between Flexbox and Grid?
⦁ Flexbox: 1D layout (row/column).
⦁ Grid: 2D layout (rows & columns).
Use Grid when layout needs both directions.

6️⃣ What are Media Queries?
Used to create responsive designs based on screen size/device.
Example:
@media (max-width: 600px) {
body { font-size: 14px; }
}


7️⃣ How do you center a div using Flexbox?
 {
display: flex;
justify-content: center;
align-items: center;
}


8️⃣ What is the difference between position: relative and absolute?
⦁ relative: positions relative to itself.
⦁ absolute: positions relative to nearest positioned ancestor.

9️⃣ Explain z-index in CSS.
Controls stacking order of elements. Higher z-index = appears on top.

🔟 How can you optimize CSS performance?
⦁ Minify files
⦁ Use shorthand properties
⦁ Combine selectors
⦁ Avoid deep nesting
⦁ Use external stylesheets

💬 Double Tap ❤️ For More
  • ❤ 24
More from @webdevcoursefree
  1. Oct 17, 2026The Finance cell spans two rows. 10. Tables vs Layout Tables should be used for tabular da…
  2. Oct 17, 2026🌐 Web Development Roadmap — Part 19 HTML Tables Tables are used to display information in…
  3. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  4. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  5. Oct 16, 2026🌐 Web Development Roadmap — Part 18 HTML Lists Lists are used whenever information needs…
  6. Oct 14, 2026🌐 Web Development Roadmap — Part 17 HTML Images — <img> Tag Images make webpages more vis…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →