2015-01-06 45 views
1

我擁有以下內容,因爲我希望輕鬆轉換所有內容。輕鬆轉換除一個元素以外的所有內容

*{transition:all .5s ease} 

但我對面只有一個元素,我不想轉型來......

我試圖定義一個名爲「沒有過渡」,並沒有跨類重要的..

.notransition { 
    -webkit-transition: none !important; 
    -moz-transition: none !important; 
    -o-transition: none !important; 
    -ms-transition: none !important; 
    transition: none !important; 
} 

我將所述類直接添加到我不想轉換的元素。

這沒有奏效。我也嘗試添加了類使用jQuery的元素,但似乎..

*{transition:all .5s ease}還覆蓋過的嘗試。

我寧願不進入每個元素,並在課堂上有一個過渡......我寧願瞄準只有一個......任何建議?

回答

1

你可以使用:not pseudo class只是否定類:

*:not(.notransition) { 
    transition:all .5s ease; 
} 

現在,所有的元素都將進行轉換,除了那些notransition類。

Example Here

+0

喜歡它,謝謝! –

相關問題