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

What is the default value of the flex property?

Default Value of the flex Shorthand Property

The flex shorthand property combines flex-grow, flex-shrink, and flex-basis. When no value is specified, it falls back to its default values.

Default Components
  1. 1

    flex-grow: 0 (the item will not grow by default).

  2. 2

    flex-shrink: 1 (the item can shrink if necessary).

  3. 3

    flex-basis: auto (the item takes its natural size).

Equivalent Default Shorthand
  1. 1

    flex: 0 1 auto;

This means by default, a flex item will maintain its initial size (auto), can shrink if the container space is limited, and will not grow to fill extra space.

Example: Default flex Values
Difficulty: 3/10
Topics: flex shorthand, default flex values, layout behavior

Scenario Questions

0-2 years experience
  1. 1

    You're building a simple two-column layout with flexbox, and one column is way taller than the other — the shorter one isn't stretching. What's the most likely cause, and how would you fix it?

  2. 2

    I added three buttons in a row using flexbox, but they're all squished together and not spacing out. What default flex behavior might be causing this, and how do you make them spread evenly?

2-5 years experience
  1. 1

    Our header bar has a logo, search bar, and user avatar — the search bar is collapsing to zero width on mobile even though it has content. What’s probably happening with flex defaults, and how would you debug it?

  2. 2

    A team member says 'flex: 1' made their card expand too much, so they removed it — now the layout breaks on small screens. Why did removing flex: 1 break it, and what’s the right way to control growth without over-expanding?

5-8 years experience
  1. 1

    We have a dynamic dashboard with 5-20 widgets that should shrink gracefully on small screens, but some widgets with images are overflowing. How would you design the flex rules to handle content-based sizing without breaking layout, and why is the default flex-basis: auto tricky here?

  2. 2

    In our component library, flex items behave inconsistently across different containers — sometimes they grow, sometimes they don’t. How would you audit and standardize the flex defaults to ensure predictable behavior without forcing explicit values everywhere?

8+ years experience
  1. 1

    We’re migrating a legacy UI from floats to flexbox, and dozens of pages have broken layouts because old code assumed content-sized elements wouldn’t shrink. How would you design a migration strategy that minimizes regressions while enforcing consistent flex defaults across teams?

  2. 2

    Our design system uses flexbox for all layouts, but engineers keep overriding flex defaults inconsistently — leading to performance hits from excessive reflows. How would you architect a CSS strategy that enforces safe, performant flex defaults at scale without requiring every developer to memorize the spec?

Follow-up Questions

  • What happens if you set width on a flex item but leave flex unset?
  • Why does a flex item with no width still take up space even when flex-grow is 0?
  • How would you make a flex item ignore its content size and stretch to fill available space?