有没有可以自动清理无效CSS的工具?

html-css012

有没有可以自动清理无效CSS的工具?,第1张

1、chrome浏览器 F12审查元素的Audits

说明:使用Audits,会检测出页面中没有用到的css,需要手动删除多余的css;同时需要说明的是检测出多余无用的css块,而不是某一行css。

2、CSS usage插件

(1)安装Firefox浏览器

(2)安装firebug

Firefox浏览器--添加附件--搜索插件--安装

(3)安装css usage

步骤同安装firebug一样。

(4)检测

重要说明:可以导出干净的css

Open the page in Google Chrome

Open the developer tools (Ctrl+Shift+I)

Under Audits tab ->Select Audits to run - "Select All" &select "Audits Present State"

click run

expand the "Remove unused CSS rules" item to view a list of style sheets that contain unused style rules.

作者:张小二

链接:https://www.zhihu.com/question/20519202/answer/24023665

来源:知乎

著作权归作者所有,转载请联系作者获得授权。

Chrome浏览器,选项中找到“工具”-“开发者工具”,会有两个窗口显示,左边的窗口上方有一排选项按钮,点击“Elements”会显示当前网页的后台代码,右边的窗口会显示对应的样式。

如果样式没起作用,会有一条横线画在对应的样式代码上面