Simply use the CSS descendant selector (a space) between the parent element and the descendant element:
ul.saft div.textSlide {
/* CSS rules */
}
JS Fiddle demo.
In this case the rules applied to the div
of class textSlide
will only apply if its ancestor is a ul
of the class saft
. You could, instead, use the immediate child combinator, the >
but then you'd have to specify the div
in relation to each parent/ancestor up to the one whose class is required, which gives potentially difficult to maintain CSS (not in this case, but it can, over time, become problematic).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…