Questions
39 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?
39 / 51

What is the difference between flex: 0 1 auto and flex: 1 0 auto?

Difference Between flex: 0 1 auto and flex: 1 0 auto

flex: 0 1 auto and flex: 1 0 auto are both shorthand for the flex property, but they control the growth and shrink behavior differently.

Key Differences
  1. 1

    flex: 0 1 autoflex-grow: 0, flex-shrink: 1, flex-basis: auto

    • Item will not grow to fill extra space.
    • Item can shrink if necessary to fit the container.
    • Base size is determined by content (auto).
  2. 2

    flex: 1 0 autoflex-grow: 1, flex-shrink: 0, flex-basis: auto

    • Item can grow to fill available space.
    • Item will not shrink below its content size.
    • Base size is determined by content (auto).

In short, flex: 0 1 auto prevents growth but allows shrinking, while flex: 1 0 auto allows growth but prevents shrinking.

Example: flex: 0 1 auto vs flex: 1 0 auto

In this example, the first item will maintain its content width and shrink if needed, while the second item will grow to fill remaining space but will not shrink below its content width.

Difficulty: 6/10
Topics: flex-grow, flex-shrink, flex-basis

Scenario Questions

0-2 years experience
  1. 1

    You're building a card layout with three items side by side. One item has a long title and the others are short. When the screen shrinks, the long title overflows. You try changing flex: 0 1 auto to flex: 1 0 auto — what changes, and why?

  2. 2

    A button in your navbar is squishing too much on mobile. The CSS says flex: 0 1 auto. If you change it to flex: 1 0 auto, will it get bigger or stay the same? Why?

2-5 years experience
  1. 1

    Our product page has a dynamic sidebar that sometimes collapses. When it does, the main content doesn’t expand to fill the space — even though it’s set to flex: 1 0 auto. What’s likely going wrong, and how would you debug it?

  2. 2

    A designer complains that the hero section’s CTA button is too narrow on tablets. It’s using flex: 0 1 auto. You change it to flex: 1 0 auto and it works — but now on small screens, the button overflows the container. What tradeoff did you just make, and how would you fix it without breaking desktop?

5-8 years experience
  1. 1

    We have a responsive dashboard with 8+ dynamic panels that can be reordered or hidden. Some panels use flex: 0 1 auto, others use flex: 1 0 auto. Users report inconsistent sizing when resizing the window — especially when panels are toggled. How would you audit and standardize this behavior across the system?

  2. 2

    In our legacy component library, we’ve seen bugs where flex: 0 1 auto causes content to overflow on iOS Safari. Meanwhile, flex: 1 0 auto fixes it but breaks layout on Android. What underlying browser differences might explain this, and how would you design a cross-platform solution without adding media queries everywhere?

8+ years experience
  1. 1

    Our design system has 30+ components using flex: 0 1 auto and flex: 1 0 auto inconsistently. We’re migrating to a new grid system, but legacy apps still rely on these values. How would you approach standardizing this at scale without breaking hundreds of pages?

  2. 2

    We’re building a multi-tenant SaaS platform where layouts are customized per customer. Some tenants expect content to shrink aggressively (flex: 0 1 auto), others expect it to expand (flex: 1 0 auto). How would you architect a theming system that lets them configure this behavior declaratively, while keeping performance and maintainability intact?

Follow-up Questions

  • What happens if you set flex: 1 0 0 instead?
  • How would this behave inside a container with overflow: hidden?
  • Can you think of a layout where switching these two values breaks the UI?