Search code examples
cssdebugging

How to debug CSS?


How does one generally debug CSS and resolve issues when some elements on the page are not appearing as they should? For now, I have to painfully comment out CSS declarations one by one to understand how the styles are getting displayed.


Solution

  • While you can not "debug" CSS, because it is not a scripting language, you can utilize the Chrome DevTools Elements panel to inspect an element & view the Styles pane on the right.

    This will give you insights as to the styles being overridden or ignored (line threw).

    View > Developer > Developer Tools
    (keyboard shortcut: CTRL + SHIFT + I)

    To find errors & warnings, use CSSLint.