从网页上卸载CSS [英] Unload CSS from webpage

查看:101
本文介绍了从网页上卸载CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从页面卸载CSS。例如在我的页面中,我添加了一个名为a.css的文件。现在我希望用户能够更改主题,这是CSS驱动的,因此他/她应该能够卸载a.css然后我可以加载b.css(否则他们会发生冲突)

Am wondering how it would be possible to unload a CSS from a page. e.g. In my page I have included a file called a.css. Now I want the user to be able to change the theme, which is CSS driven, thus he/she should be able to unload a.css and then I can load b.css (else they will conflict)

任何想法如何解决这个问题?

Any idea how to go about this?

推荐答案

获取link元素并将其禁用

Take the link element and disable it

document.getElementsByTagName('link')[0].disabled = true; 

这篇关于从网页上卸载CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆