Questions
37 of 51
1What is Flexbox in CSS?
2What problem does Flexbox solve compared to traditional layouts like float or inline-block?
3How do you create a flex container?
4What are the main and cross axes in Flexbox?
5What does the display: flex property do?
6What is the difference between display: flex and display: inline-flex?
7What are flex items?
8How do you change the direction of items in a flex container?
9What does flex-direction: row do?
10What does flex-direction: column do?
11What is the purpose of the justify-content property?
12What does the align-items property control?
13What are the possible values of align-content?
14What is the difference between align-items and align-content?
15What is the use of the flex-wrap property?
16How can you make flex items wrap onto multiple lines?
17What does the flex-flow shorthand property do?
18How does the order property affect flex items?
19How does the align-self property work?
20How do you vertically center content using Flexbox?
21What does the flex shorthand property represent?
22What are the three components of the flex shorthand property?
23What is the default value of the flex property?
24How do flex-grow, flex-shrink, and flex-basis work individually?
25What is the difference between flex: 1 and flex: auto?
26What is the difference between flex: 1 and flex: auto?
27What is the purpose of the gap property in Flexbox?
28How does Flexbox handle overflowing content?
29What’s the difference between justify-content: space-around and space-between?
30How does Flexbox handle fixed and flexible widths together?
31Can Flexbox be nested?
32How is Flexbox different from CSS Grid?
33When would you use Flexbox instead of Grid?
34Can you use Flexbox and Grid together in the same layout?
35How does Flexbox differ from traditional float-based layouts?
36Does Flexbox affect the box model or positioning of elements?
37How does Flexbox handle min-width and max-width constraints?
38How do flex items align when the container has align-items: stretch?
39What is the difference between flex: 0 1 auto and flex: 1 0 auto?
40How does flex-basis differ from width?
41How do you prevent a flex item from shrinking?
42How would you create a horizontal navigation bar using Flexbox?
43How do you center a div both horizontally and vertically using Flexbox?
44How can you make a responsive layout using Flexbox?
45How can you make one flex item take up the remaining space in a container?
46How do you create equal-height columns using Flexbox?
47How can you align the last flex item to the right side of the container?
48How can you reorder items visually using Flexbox without changing the HTML structure?
49How can you make items stack vertically on mobile and horizontally on desktop using Flexbox?
50How do you prevent an element from wrapping in a flex container?
51How can you align items to the bottom of a container using Flexbox?
37 / 51

How does Flexbox handle min-width and max-width constraints?

Flexbox with Min-Width and Max-Width Constraints

Flexbox respects min-width and max-width constraints on flex items. These constraints limit how much a flex item can grow or shrink, regardless of flex-grow or flex-shrink values.

Key Points
  1. 1

    min-width: Ensures a flex item does not shrink below a certain width, even if flex-shrink is set to allow shrinking.

  2. 2

    max-width: Prevents a flex item from growing beyond a certain width, even if flex-grow allows expansion.

  3. 3

    Flex items still distribute remaining space according to flex-grow and flex-shrink, but within the limits set by min-width and max-width.

  4. 4

    These constraints are useful for maintaining readability and layout integrity on responsive designs.

Example: Flex Items with min-width and max-width

In this example, each flex item grows and shrinks to fill available space but will never be smaller than 100px or larger than 200px, preserving layout consistency.

Difficulty: 6/10
Topics: flex-basis, min-width conflict, max-width override

Scenario Questions

0-2 years experience
  1. 1

    You're building a card component with a title and a short description. The title is long and wraps awkwardly on small screens. You set min-width: 200px on the card, but now it overflows the container. What’s likely happening, and how would you fix it?

  2. 2

    I set max-width: 300px on a flex item expecting it to never get wider, but it’s still stretching across the whole row. What’s the most common mistake causing this?

2-5 years experience
  1. 1

    Our responsive product grid breaks on tablets: some cards with long product names overflow their containers even though we set max-width. The flex container has display: flex and flex-wrap: wrap. What’s the root cause, and how would you fix it without breaking mobile layout?

  2. 2

    A teammate says they set min-width: 250px on a flex item, but it’s still collapsing when the viewport shrinks. You check the code and see no overflow: hidden or width: 0. What other CSS property might be overriding min-width, and how would you diagnose it?

5-8 years experience
  1. 1

    We have a dynamic sidebar with collapsible panels that use flexbox. When panels are collapsed, min-width causes layout jank on resize. When we remove min-width, content becomes unreadable on small screens. How would you design a resilient system that balances accessibility, performance, and layout stability across devices?

  2. 2

    In a large-scale dashboard with 50+ flex-based widgets, users report inconsistent widths on high-DPI displays. Some widgets respect max-width, others don’t — even with identical CSS. What systemic issues could cause this, and how would you audit and fix them at scale?

8+ years experience
  1. 1

    We’re migrating a legacy UI from float-based layouts to flexbox. Many components rely on hardcoded widths and min-width to prevent content overflow. How would you approach this migration without breaking existing user workflows or introducing performance regressions across 200+ pages?

  2. 2

    Our design system uses flexbox with min-width and max-width for component consistency, but different teams are overriding these values inconsistently. How would you enforce layout boundaries at an architectural level — considering tooling, documentation, and developer experience — without stifling flexibility?

Follow-up Questions

  • What happens if you set min-width to 100% on a flex item inside a narrow container?
  • How would you debug a layout where max-width seems to be ignored?
  • When would you choose min-width over setting a fixed width in a flex container?