Skip to content
TechToolsHQ
NewsReviewsGuidesTech 101Tech SeriesToolsNewsletter
TechToolsHQ

Independent, research-driven tech coverage — breaking news, in-depth reviews, buying guides, and technical tutorials to help you understand and choose with confidence.

Explore
NewsReviewsGuidesTech 101Tech SeriesFree Tools
Legal
About UsOur AuthorsContact UsPrivacy PolicyTerms of ServiceCopyright & DMCAAffiliate DisclosureEditorial PolicyAdvertise With Us

© 2026 TechToolsHQ. All rights reserved.

Tech Series/Chrome DevTools Essential/Debug Modern CSS Layout: Flexbox, Grid, Subgrid & Container Queries
Chrome DevTools Essential · Part 3 of 3

Debug Modern CSS Layout: Flexbox, Grid, Subgrid & Container Queries

Turn on DevTools' visual overlays to see exactly where your rows, columns, gaps, and container breakpoints really are.

By Himanshu Bhatt· 5 min read· August 29, 2026

3D Google Chrome logo floating above a green background with a soft shadow.
Key Takeaways · TL;DR
  • A flex or grid badge appears next to any element using that layout; clicking it toggles a visual overlay on the page.
  • The Layout pane lists every flex and grid container so you can turn overlays on, off, and recolor them.
  • The subgrid badge toggles an overlay for a grid that inherits its parent's tracks.
  • Container queries let an element respond to the size of its container, not the whole viewport; DevTools shows a container badge and the @container rule.
  • In recent Chrome you can edit an @container rule's conditions directly in the Styles pane to test new breakpoints.
☰ On this page(show)(close)
  • 1.Why layout needs visual tools
  • 2.Debugging Flexbox
  • 3.Debugging CSS Grid
  • 4.Subgrid
  • 5.Container queries: responsive to the container, not the screen
  • 6.Bonus: the Animations panel
  • 7.Hands-on: debug a layout and tune a breakpoint
  • 8.What's next
On this page
  • 1.Why layout needs visual tools
  • 2.Debugging Flexbox
  • 3.Debugging CSS Grid
  • 4.Subgrid
  • 5.Container queries: responsive to the container, not the screen
  • 6.Bonus: the Animations panel
  • 7.Hands-on: debug a layout and tune a breakpoint
  • 8.What's next
INFO

Where we are: So far you have opened DevTools (Part 0) and learned to inspect elements and edit CSS in the Styles pane (Part 1). This part tackles the hardest thing to debug by hand — layout — using DevTools' visual overlays. If you can select an element and read the Styles pane, you are ready.

Why layout needs visual tools

Flexbox, grid, and container queries position elements using rules you cannot always see in the numbers. A gap might come from justify-content, a margin, or an empty grid track. DevTools solves this by drawing the layout directly on the page, so you can see the structure instead of guessing.

Debugging Flexbox

Flexbox is a one-dimensional layout system — it arranges items in a row or a column. When an element uses display: flex or display: inline-flex, DevTools shows a flex badge next to it in the Elements panel.

  • Toggle the overlay: click the flex badge to draw a dotted outline over the container and its items, showing how space is distributed.
  • Use the flexbox editor: in the Styles pane, click the icon next to display: flex to open an editor where every alignment property is a clickable icon — no need to remember align-items versus justify-content.
  • Manage overlays: open the Layout pane and scroll to the Flexbox section to list every flex container and recolor each overlay.
DevTools flexbox visual overlay on page and the interactive flexbox editor open in Styles pane
The flexbox editor in Chrome DevTools turns alignment properties into clickable icon buttons.•TechToolsHQ / Original Screenshot

Debugging CSS Grid

Grid is a two-dimensional layout system — it arranges items in rows and columns at once. Elements using display: grid or display: inline-grid show a grid badge. Click it to overlay the grid on the page, complete with line numbers.

Open the Layout pane and find the Grid section for finer control. There you can switch the overlay's labels between Show line numbers, Show line names, and Show track sizes, reveal area names, extend the grid lines to the viewport edge, and display several grids at once, each in its own color.

INFO

Pro tip: Next to display: grid in the Styles pane is a Grid Editor button. It lets you set alignment and justification with clicks instead of typing, exactly like the flexbox editor — a fast way to learn what each grid property does.

Subgrid

Subgrid lets a nested grid borrow the rows or columns of its parent, so child items line up perfectly with the outer grid. When an element uses subgrid, DevTools shows a subgrid badge. Click it to toggle an overlay that reveals the inherited tracks, so you can confirm the alignment is coming from the parent.

Container queries: responsive to the container, not the screen

A container query lets an element change its style based on the size of its parent container rather than the size of the whole browser window. That makes a component — a card, a sidebar widget — truly reusable, because it adapts wherever you drop it.

DevTools shows a container badge next to a query container; click it for a dotted overlay of the container and its descendants. Select an element affected by a query and the Styles pane shows the @container rule, with a link up to the parent container so you can jump between them.

INFO

New in recent Chrome: you can now edit an @container rule's conditions directly in the Styles pane — for example, change inline-size > 400px to inline-size > 520px — and watch the layout respond immediately. This makes finding the right breakpoint a matter of trial, not math.

Styles pane showing an editable @container rule condition with inline-size badge and container overlay
Editing an @container breakpoint live — change the condition in Styles, see the layout react.•TechToolsHQ / Original Screenshot

Bonus: the Animations panel

CSS animations are part of layout and feel, and they are just as hard to inspect while they play. Open the Animations panel from the Command Menu (Ctrl+Shift+P, type "Show Animations") or More Tools › Animations. It automatically captures animations into groups as they run.

  • Slow it down: use the Animation speed buttons to play an animation at reduced speed.
  • Scrub it: drag the red playhead along the timeline to move through the animation frame by frame.
  • Inspect and replay: click an animation group to see its details, and press Replay to run it again.
INFO

Coming later: the Elements panel can also set DOM breakpoints — pausing your code when an element changes. That belongs with JavaScript debugging, so we cover it in the Sources lesson (Part 5). For now, keep it in your back pocket.

Hands-on: debug a layout and tune a breakpoint

  1. 1
    Find a grid: on any grid-based page, inspect the container and click its grid badge to show the overlay.
  2. 2
    Label it: open the Layout pane and turn on Show track sizes and Show line names.
  3. 3
    Find a flex row: inspect a navigation bar or button row, click the flex badge, and open the flexbox editor to change the alignment with clicks.
  4. 4
    Container query: if the page uses one, edit the @container condition in the Styles pane and watch the component reflow. (No container query handy? Try Chrome's own docs pages, which use them.)
  5. 5
    Break & Fix: change one grid item's grid-column to an out-of-range value, watch it break in the overlay, then use the visible line numbers to correct it.

What's next

You can now see and fix layouts instead of guessing at them. So far everything has been visual. Next we open the Console — where you type live JavaScript, read errors, and, for the first time in this series, ask DevTools' built-in AI to explain what went wrong.


Frequently asked questions

What is the difference between flexbox and grid?
Flexbox is one-dimensional — it lays items out in a single row or column. Grid is two-dimensional — it positions items across rows and columns at once. DevTools shows a flex badge for one and a grid badge for the other.
How do I turn on the grid overlay in Chrome DevTools?
In the Elements panel, click the grid badge next to an element that uses display: grid. For more control — line numbers, track sizes, area names — open the Layout pane and use its Grid section.
What is a container query, and how is it different from a media query?
A media query responds to the size of the whole viewport. A container query responds to the size of an element's own container, so a component adapts wherever it is placed. DevTools marks containers with a container badge.
Can I change a container query breakpoint without editing my source files?
Yes. In recent Chrome you can edit an @container rule's condition directly in the Styles pane and see the result live. As with all live edits, copy it from the Changes drawer before reloading, because it is not saved to your files.

This article was produced with AI assistance for drafting and research. All facts have been verified and the final content has been reviewed and approved by a human editor.

Share
📝 Interactive Quiz

Test Your Knowledge

📋 3 questions🎯 70% to pass⏱ ~2 min
Series: Chrome DevTools Essential

Part 3 — Debug Modern CSS Layout: Flexbox, Grid, Subgrid & Container Queries

Part 3 of 3
← Previous partPart 2 — The Elements Panel: Inspect and Edit Any Web Page Live
Latest episode in this series.

Enjoying the Chrome DevTools Essential series?

TechToolsHQ is an independent, reader-supported tech platform. If this article saved you time, solved a tough problem, or helped you learn a new skill, consider supporting our work. Your support helps us keep our in-depth series 100% free and updated for everyone.

100% optional · Reader supported · Independent researchSupport our work

Don't miss the next deep-dive

Weekly breakdowns of the tools students and builders actually use.

No spam·Unsubscribe any time·Privacy-first