How to find class =“class1” included class=“class2” in CSS? [closed]


Tags: css

Problem :

How to use css_selector find <div class="class2"></div>?

<div class="class1">
    <div>
        <div class="class2"></div>
    </div>
</div>

I think use css_selector_class find <div class="class2"></div>,How write the css_selector by class?



Solution :

You could use the descendent selector () or be more specific with the child selector > like so

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

Per your comment on Tushar's answer, if you want to find a div with both class1 and class2, the selector is like this

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

    CSS Howto..

    How to apply gradient color in css?

    How to define separate fonts for each font-style - CSS

    How to apply CSS only if class exists elsewhere in code?

    How to Properly Add CSS in a MailMessage

    How to get custom css to load after richfaces?

    how to position nested list items?

    How to I get this element to span 100% of LI? [closed]

    How to style HTML paragraphs with CSS to prevent empty lines between them?

    How to vertically align inline-block elements with height set and test with browser tools

    how to override the placeholder icons în AEM 6?

    how to add empty space between cells in tables?

    how to set part of circle as background in css

    How to responsive the large background image using CSS (WordPress)

    How to remove “pictureframe” in Internet Explorer?

    Showcase Image and Carousel Caption

    How to use inline css styling (style=“vertical-alignment:middle;”) in html5 or