Chrome - disable all styles from specific .css file

This is based on Rob W's helpful answer

Just paste the following into your console and change the index value accordingly.

First execution will disable stylesheet and the second will enable it.

var stylesheetIndex = 0;
var action = document.styleSheets[stylesheetIndex].disabled === false ? "Disabled " : "Enabled ";
document.styleSheets[stylesheetIndex].disabled = !document.styleSheets[stylesheetIndex].disabled;
console.log( action + "stylesheet:" + document.styleSheets[stylesheetIndex].href );

You can open the Network tab in Dev Tools and find the particular CSS file that you want to disable. Right click on it and select "Block request URL", then refresh the page (make sure "disable cache" is checked at the top of your dev tools as well). Now the request for that particular CSS file will be blocked when the page loads. You can also right click it again and unblock it.

enter image description here


If you want to remove the style for the remainder of the page session, open the DOM Inspector, locate the <link> or <style> element which links the style sheet, and remove the element. This causes all associated styles to be removed.

If you only want to disable the style sheet temporarily, add a new attribute disabled to the <link>/<style> element. Remove this attribute to enable the style sheet again.

If the site contains lots of distracting DOM elements, you can also visit the console, and something like document.styleSheets[0].disabled = true; (where 0 is the index of the style element).


One way would be to just find the:

<link rel="stylesheet" href="yourstyle.css" />

And change it to something else...

<link rel="stylesheet" href="yourstyleXXX.css" />

Which would stop it from working...

I bet there is a way in dev tools though...

The problem is that most people are concatenating and minifying their CSS with preprocessors... so you won't be able to take this approach in these cases.