Firefox DevTools can explain why some CSS styles have no effect

Published on in CSS and CSS for JS Devs course

It's frustrating when a CSS declaration is technically valid (not crossed out in the browser's DevTools) but has no effect for some reason. Firefox DevTools can often tell you why and also how to potentially fix those issues!

Starting from Firefox 70 (released in October 2019), its DevTools contain "inactive CSS rules indicators" that explain why some styles have no effect:

Firefox DevTools' inactive CSS rule indicator. Here it's saying that "width has no effect on this element since it has a display of inline. Try adding display:inline-block or display:block."

I use Firefox as my daily browser, but usually switch to Chrome when doing web development because Firefox DevTools often feel buggy. Good to know that Firefox DevTools can be very helpful in these frustrating CSS situations.

I learned this trick from Josh W Comeau's CSS for JavaScript Developers course (Module 0).

Later I also found Elijah Manor's video explaining the feature.