Demo · CSS styles chain

CSS styles chain

When someone is building a website, they often open a tool called the DOM inspector. Current versions of Chrome call that tool DevTools. It is where you look when a page’s design, its CSS, or its performance is off.

This page is a demo of a redesign of one part of that inspector: the CSS styles pane. That is the list you get after you click an element and want to know which settings are actually in force. The elements tree and the rest of DevTools are left alone for now.

In that list, a lot of the lines are crossed out. The crossed-out line is often the one that says what you were looking for.

Scroll, and the next copy of that same setting is crossed out too. The docs say the winner sits above the strike. On a real card, both background lines are struck, and the line that paints the card is further down, on a rule whose name does not look like the thing you clicked.

The struck line does not point at the line that beat it. If that one lost as well, there is still no trail. You start to wonder if the line is crossed out because it uses a variable defined further up the page. That is a bad way to draw it, and it isn’t what happened. The variable is only the value. Another rule won.

The rule’s name makes the hunt worse. .doc .openblock.cards .exampleblock.tile > .content reads as if the box you clicked carried every one of those classes, or as if each class donated a property. The box only has content. The other words are checks on the boxes around it, and every check has to pass. A comma starts a second check. The grey half is the check that failed. Those grey words are not classes on your element. Hover the rule and the panel shows (0, 6, 0). The middle number is how many classes are in the check. The panel never says so.

A color or a font that came from the page around the box is dropped into the same flat list, as if the box had set it. Right-click a property and the last item in the menu, with no icon, is “View computed value.” That opens another tab, leaves a diagram of the box up, and then lists every name that contains the word you asked about. Ask about background and background-color, background-image, and the rest show up at the same size.

The buttons below open another way of reading that same card. One is the tool. One is the card by itself, so you can open Chrome’s panel on it and compare. The third draws an earlier version of the idea inside a page.

Open the inspector Open the sample page In-page layout