2012-07-05 70 views
0

是否可以在下面更改「查看結果」文本的顏色?加載後更改字體顏色

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/6352993.js"></script> 
    <noscript><a href="http://polldaddy.com/poll/6352993/">This is very long test question to test how polldaddy handles questions that exceed that normal length............ yes a very long question indeed..............</a></noscript>​ 

我試圖重寫CSS「PDS - 視圖 - 結果」,這是什麼「查看結果」樣式爲,但沒有效果:

.pds-view-results { 
    color: red; 
} 

這裏是一個小提琴:

http://jsfiddle.net/25LjE/36/

+0

你能解釋一下嗎?你想改變視圖結果的顏色嗎? – muthu 2012-07-05 11:10:42

+0

@muthu是的,它現在的工作 – user701254 2012-07-05 12:35:05

回答

5

由於鏈接的顏色已經由規則規定,你應該通過!important關鍵字重寫它

.pds-view-results { 
    color: red !important; 
} 
1

你可以從JavaScript做到這一點:

$('.pds-view-results').css('color', 'red'); 
+0

爲什麼用JavaScript,如果你可以用純CSS做到這一點? – Trogvar 2012-07-05 11:13:27

+0

爲了避免「重要」,如果它仍然存在,您不能重寫。 – 2012-07-05 11:15:21

1

您還可以設置您的style

這樣就可以避免!importantjavascript。但是,我會建議你只放置最後一條CSS規則,因爲這可能會導致閃爍。試試吧,它可能適合你。

<script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/6352993.js"></script> 
<noscript><a href="http://polldaddy.com/poll/6352993/">This is very long test question to test how polldaddy handles questions that exceed that normal length............ yes a very long question indeed..............</a></noscript> 

<style type='text/css'> 
    .pds-pd-link { 
display: none !important; 
} 
.pds-box { 
    width: 220px !important; 
} 
.pds-input-label{ 
    width: auto! important; 
} 
.PDS_Poll{ 
    margin-bottom:15px; 
} 
.pds-view-results { 
    color: red; 
} 
#PDI_container6352993 .pds-links a{ 
    color:blue; 
} 
</style>​ 

http://jsfiddle.net/nXS4J/