Inspect and troubleshoot flex layouts in browser tools.
When Flexbox does not behave as expected, check the container, its axes, and the available space. A valid property may have no visible effect if it is on the wrong element or has no space to work with.
In Chrome DevTools:
display value is flex or inline-flex.The flex editor can also change alignment visually. An overlay makes it easier to distinguish flex lines from the boxes inside them. See the Chrome Flexbox debugging guide.
| Symptom | Check first |
|---|---|
| Items remain in normal block flow. | Is the intended wrapper actually a flex container? |
justify-content seems ineffective. | Is there positive main-axis space after item growth and auto margins? |
| Vertical centering changes nothing. | Which axis is vertical, and does the container have spare space? |
align-content does nothing. | Is wrapping enabled, and is there cross-axis space for the lines? |
| A long title pushes a sibling outside the container. | Is an automatic minimum preventing the text item from shrinking? |
.result {
display: flex;
width: 16rem;
gap: 1rem;
}
.result-copy {
flex: 1 1 0;
}
.result > button {
flex: none;
}The copy can grow and shrink, but its automatic minimum can still protect the width of an unbroken word. Setting a shrink factor alone does not remove that minimum.
Add these two declarations:
.result-copy {
min-width: 0;
overflow-wrap: anywhere;
}min-width: 0: Permits the row item to become narrower than its automatic minimum.overflow-wrap: anywhere: Lets an otherwise unbreakable string break when necessary.Try the minimum-width change on its own. The box can shrink while an unbroken identifier still sticks out of it. Then enable wrapping and watch the word break. Break opportunities created by anywhere also count when the browser calculates the item’s minimum content width.
Resize the component and try longer content. Keep the button readable and ensure the title remains available. Inspect any crossed-out declaration to find the rule that overrides it, then change the stylesheet itself after confirming the experiment in DevTools.
Avoid applying overflow: hidden merely to conceal the symptom. Clipping may remove visible text without correcting the sizing decision.
In the result example, the copy has flex: 1 1 0 but still overflows. What should you inspect before increasing its shrink factor?
Inspect the copy item's minimum size and the unbroken text. The automatic minimum can stop the item shrinking even though its shrink factor permits it.
If you set min-width: 0 but the long word still paints outside its narrower box, what separate change helps the text fit?
Add overflow-wrap: anywhere to permit breaks within the long word. The minimum controls the box; wrapping controls the text inside it.
Try it yourself
HTML + CSS