2011-03-28 73 views
0

是否可以在頁面的某些部分打開CSS? 我可以用<noscript>,但它允許JavaScript腳本也...<noscript>僅適用於CSS?

問題是,我有很多全球性的造型爲許多頁面上的元素,現在我需要插入新的(換新很多的),和我不能一個一個去1000個元素,並改變他們...

是否有可能做到這一點,而不必一個一個地改變?

此外,還有字體大小:70%的比例,而我不能覆蓋,在我的代碼...

所以,我怎麼能阻止嗎?像<noscript>但只適用於CSS?

+0

你可以使用JS來包含你的CSS。 – 2011-03-28 00:30:07

回答

1

<noscript>不關閉JavaScript,它給出了僅僅渲染代碼如果javascript被關閉。

我不完全清楚你在這裏的含義。我想認爲你的意思是說,你想在你的一些頁面中應用非常不同的樣式到一些新的作品。如果它們處於連續的塊中,則可以將它們放入div中,然後在新樣式中使用它們。例如。說你有:

CSS:

p {color: green; font-family: serif;} 
a {color: blue;} 
/* lots and lots of other declarations */ 

HTML:

<p>Here is a paragraph, there are a lot of these</p> 
<p>Here is a paragraph I need in the new style, there are a lot of these too!</p> 

然後,你可以這樣做:

CSS:

p {color: green; font-family: serif;} 
a {color: blue;} 
/* lots and lots of other declarations */ 

.newStyle p {color: black; font-family: sans-serif;} 
.newStyle a {color: red;} 
/* lots and lots of other declarations */ 

HTML:

<p>Here is a paragraph, there are a lot of these</p> 
<div class="newStyle"> 
    <p>Here is a paragraph I need in the new style, there are a lot of these too!</p> 
</div> 
+0

我用這個:.destroyall * { \t vertical-align:auto; \t font-size:100%!important; \t border:0 none; \t提綱:0; \t padding:0; \t margin:0; \t text-align:auto; \t line-height:1; \t vertical-align:auto; \t}但仍然字體大小從75%繼承...如何消除這種情況? – SharkTheDark 2011-03-28 01:01:34

+0

font-size基於包含框的字體大小。嘗試.destroyall {font-size:133.33333333%}(注意:.destroyall不在.destroyall *上)。 – 2011-03-28 01:12:13

0

您可以使用查找和替換在許多IDE發現的工具,新的更好的CSS來取代舊的壞CSS或只是將其刪除徹底