[英]Can i load css from the original file?
Seems like to me there should be an option for that but i can't seem to find it. 在我看来,应该对此有一个选择,但我似乎找不到。
This question was asked many times but only workarounds were answered and that's not what i'm looking for. 这个问题被问过很多次,但只有解决方法得到了回答,这不是我想要的。
I am changing my css incode and i want to load the original css back instead of coding it myself, how can that be achived? 我正在更改CSS内码,但我想重新加载原始的CSS而不是自己进行编码,如何实现?
I don't wanna reload the entire file, just load some div or class css. 我不想重新加载整个文件,只加载一些div或class CSS。
if you're using jQuery apply 如果您使用的是jQuery,请套用
$(selector).removeAttr('style')
to your elements 对你的元素
I want to load the original css back instead of coding it myself
我想重新加载原始CSS而不是自己编码
This is not necessary. 这不是必需的。 You are trying to reload a resource that should just continue to exist.
您正在尝试重新加载应该继续存在的资源。 Once it's loaded, you don't need to load it again.
加载后,您无需再次加载。 If you need to override a style, apply a class to it.
如果您需要覆盖样式,请对其应用一个类。 To revert to original, remove the class.
要还原为原始语言,请删除课程。 That's how cascading style sheets work.
这就是级联样式表的工作方式。
If there is a particular reason the css needs to be dynamic, you can try loading css into the Document via the DOM ( document.createElement("style")
etc.), but support for this is a bit sketchy I believe. 如果有特殊的原因需要使css动态化,则可以尝试通过DOM将css加载到Document中(
document.createElement("style")
等),但是我认为对此有点支持。
如果您想重置整个样式,而不仅仅是div,则最好使用all selector
$('*').removeAttr('style');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.