Chrome - disable all styles from specific .css file

风格不统一 提交于 2019-12-03 00:57:23

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).

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 );

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.

Install the "Web developer" extension for Chrome. You will then have various options, including the "Edit CSS", where you can make changes to any CSS file on the fly (or just completely remove its' contents).

https://chrome.google.com/webstore/detail/web-developer/bfbameneiokkgbdmiekhjnmfkcnldhhm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!