2015-10-18 71 views

回答

2

您可以使用後代選擇器(),或與孩子選擇>更具體的,像這樣

div.class1 > div > div.class2 { . . .} //any div.class2 in a div in a div.class1 

div.class1 div.class2 { . . . } //any div.class2 that is a descendent of a div.class1 

每對圖莎爾的回答您的意見,如果你想找到既class1class2一個div ,選擇是這樣的

div.class1.class2 { . . . } //any div with both class1 and class2 
+0

對不起,我只是課堂上使用css_selector,但是,此代碼是不靈活 。我想找到所有的Class2,如果我有很多的Class2 –

+0

這是非常不清楚你是什麼問。請更新您的問題與更多信息。 – CollinD

+0

對不起,.class1 .class2 {...},這是對的,謝謝 –