2011-04-25 77 views

回答

3

您可以通過在加載它們的元素上設置disabled屬性(內聯樣式的style元素或鏈接樣式表的link元素)來禁用樣式。禁用時,樣式表的規則不適用。

例子:

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> 

(我知道,我知道,tt已被棄用)

的JavaScript:

document.getElementById('theParagraph').onclick = function() { 
    var style = document.getElementById('style2'); 
    style.disabled = !style.disabled; 
}; 

Live copy

2

這意味着其中包含將不會應用其樣式聲明。

jsFiddle

3

如果屬性disabled<link>標記添加包含在網頁樣式表將被禁用...

這當網頁應用多個主題主要用於...和具有的東西Themeroller