Inspect and Debug CSS Flexbox and Grid Layouts by using the Layouts Tab in Dev Tools

Updated . Posted . Visible to the public.

tl;dr

In Chrome DevTools in the Layouts tab you have handy options to debug CSS Flexbox and Grid. Including:

  • Display size and lines along with labels
  • Changing their attributes
  • Change how overlay is colored and fastly switch nested elements in the Elements panel

This guide will only cover some example gif recordings on how to use with Grid, since it's basically straight forward to apply this for Flexbox by yourself afterwards.

For this purpose a the link to documentation and a simple code pen have been added for both use cases.

Grid

You can use this Code Pen Show archive.org snapshot to play around with the different options.

Read Inspect Grid Show archive.org snapshot to check for full details.

Discover The Layouts Pane to inspect

You can toggle the grid badge for every elements that has display: grid or display: inline-grid applied to it. Now the Layout Pane will have several options on how to display this element.

Image

Use the Grid Editor to debug

You can set different properties on on how the grid elements are aligned etc. directly and track their sizes with the layout display.

Image

Change Grid Overlay Behavior

When nesting several grid, you can directly grep them in the layouts tab and change the color by which they are represented.

Image

Flexbox

The functions for flexbox basically work the same way as for grid. For this reason I will only link this Code Pen Show archive.org snapshot and encourage you to play around by yourself.

For full detail check Inspect Flexbox Show archive.org snapshot .

Felix Eschey
Last edit
Felix Eschey
License
Source code in this card is licensed under the MIT License.
Posted by Felix Eschey to makandra dev (2022-11-15 08:15)