CSS样式表禁用? [英] css javascript style sheet disabled?
本文介绍了CSS样式表禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
禁用样式表意味着什么?
我刚刚意识到,当我访问此页面时可能会出现这种情况。 https://developer.mozilla.org/en/DOM/HTMLStyleElement
您可以通过在加载它们的元素上设置
disabled
属性来禁用样式(用于内联样式的样式
元素,或用于链接样式表的链接
元素)。禁用时,不应用样式表的规则。 示例:
CSS:
< style id ='style2'>
p {
color:green;
font-weight:bold;
}
< / style>
HTML:
< p id ='theParagraph'>点击此段落可切换< tt> style2< / tt> < / p>
(我知道,我知道, tt
已淘汰。)
JavaScript:
document.getElementById('theParagraph')。onclick = function(){
var style = document.getElementById('style2');
style.disabled =!style.disabled;
};
what does it mean to have a style sheet disabled?
I just realised that its possible when i visited this page.. https://developer.mozilla.org/en/DOM/HTMLStyleElement
解决方案
You can disable styles by setting the disabled
property on the element that loaded them (either a style
element for inline styles, or a link
element for linked stylesheets). When disabled, a stylesheet's rules aren't applied.
Example:
CSS:
<style id='style2'>
p {
color: green;
font-weight: bold;
}
</style>
HTML:
<p id ='theParagraph'>Click this paragraph to toggle the <tt>style2</tt> styles.</p>
(I know, I know, tt
is deprecated.)
JavaScript:
document.getElementById('theParagraph').onclick = function() {
var style = document.getElementById('style2');
style.disabled = !style.disabled;
};
这篇关于CSS样式表禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文