I started to learn CSS grid layout. In an ideal world, I would be able to set up a div with multiple grid boxes and place my elements exactly within them, providing overlays when needed (kind of like using Sticky on Grid in Illustrator).
This can be very difficult without a visual representation of the grid, is it possible to see a grid on my live server? I tried using Chrome Dev Tools "Show Gridlines" but every time I refresh or make a change, they disappear.
Alternatively, is there a better system I can use when I want to have a more precise layout consisting of multiple elements and empty space?
Firefox browser has this function https://firefox-source-docs. mozilla.org/devtools-user/page_inspector/how_to/examine_grid_layouts/index.html
A bug has been created for the issue you are experiencing https://bugzilla.mozilla.org/show_bug.cgi?id=1342310
As @ashish-singh already answered, leveraging native browser developer tools is a good option, for example Firefox CSS Grid Inspector has been mentioned, Even Chrome checks the CSS Grid Layout feature. They are powerful features that provide important information about rendered columns, rows, gaps, etc.
Anyway, if you really want to implement a persistent cross-refresh method using CSS, I recommend using some
outline
tricks on your grid items. I recommend using outlines because with them items can collapse onto each other (since outlines technically don't take up space), but also because dynamically showing and hiding outlines doesn't trigger a browser layout recalculation (performance was better during testing).Here is a simple example showing what happens in action: