⚡
Q1. Flexbox main axis vs cross axis?
A. justify-content aligns along the main axis; align-items aligns along the cross axis (depends on flex-direction).
Mid
⚡
Q2. When to use Grid vs Flexbox?
A. Grid for 2D layouts (rows+cols). Flexbox for 1D layout (row or column).
Mid
⚡
Q3. How do media queries work?
A. They apply styles based on conditions like viewport width, prefers-reduced-motion, etc.
Mid
⚡
Q4. What is position: sticky?
A. It behaves like relative until a scroll threshold then sticks like fixed within its container.
Mid
⚡
Q5. What creates a stacking context?
A. Examples: position with z-index, transform, opacity < 1, filter, and more.
Mid
⚡
Q6. How do you center an element?
A. Common: flex (justify-content/align-items), grid (place-items), or margin: 0 auto for blocks.
Mid
⚡
Q7. What are CSS variables?
A. Custom properties like --color used via var(--color). They cascade and can be updated dynamically.
Mid
⚡
Q8. What is z-index?
A. Controls stacking order inside a stacking context. Requires understanding of stacking contexts.
Mid