2017-08-03 89 views
0

Modernizr爲文檔的<html>標記添加類,例如, <html class="no-touchevents">在Modernizr中使用CSS模塊(類名)

在我的代碼中,我曾經寫過類似這樣的東西。

.style { background: green; } 
.no-touchevents .style { background: red; } 

因此,如果支持觸摸,元素將爲綠色(確定),否則爲紅色(錯誤)。現在使用CSS模塊,我的.style類被定義在一個文件中,並被轉換成這樣的東西。

.xR23A { background: green; } 
.hjTT7 .xR23A { background: red; } 

如果我換我在:global條款類,它應該保持不變,如果我理解正確。但是,這將適用於每個嵌套類,所以我會保持這一點。

.xR23A { background: green; } 
.no-touchevents .style { background: red; } 

如何解決這個問題以達到所需的解決方案?這就是我所追求的。

.xR23A { background: green; } 
.no-touchevents .xR23A { background: red; } 

回答

1

你應該能夠使用paren版本的全球只hoiz modernizr部分。

.style { background: green; } 
:global(.no-touchevents) .style { background: red; } 
+0

得到它現在再次合作,謝謝! – lmenus