How to select Parent Div in CSS [duplicate]


Tags: css,css3

Problem :

This question already has an answer here:

I am trying to select a parent div in google earth which it doesnt have any id or class and it it is just a div element. I used this method

div < div.well {background-color: red !important; }

since the div contains another div with the class of .well but this seems not working! can you please let me know what i am doing wrong?

Thanks

Update

Please Look at This Jsfiidle



Solution :

I dont know the context here, but if you can't modify the html, this is possible with jQuery as follows:

<script>
jQuery('div.well').parent('div').css('background', 'red');
</script>

As others have noted, there is no CSS solution.


    CSS Howto..

    How to set a css class to table header cell

    First and Second touch of a button, how to show images at different times?

    In html, how is a child element's percentage-based size calculated when its parent has padding?

    how to invoke css file in jquery

    How to turn off :hover with CSS?

    How do I make a popup contact form exit when clicking the external background div?

    How to override inline css through javascript?

    How to arrange dissimilar
    elements to flow inline inside an
    element

    How to create a CSS? [closed]

    How do you hide an HTML element based on a series of parent elements

    How to use css animate correctly?

    How to limit width of

    -

    tag by length of content

    How do I set the table cell widths to minimum except last column?

    How to convert a rectangle to TRBL CSS rect value?

    Dropdown list showing vertically in Internet explorer

    HTML5 (php) with CSS Tooltip shows up far away from hyperlink

    PhoneGap: How to get iPad specific CSS to work?

    How to apply css styles in embed widget

    How do I expand this CSS list?

    Bootstrap Icons not showing in published ASP.NET MVC application

    Why does the dropdownlist show under the div

    How to override css-setting for the elements of nested table?

    How to override css class without touching the HTML?

    How to :hover one div on two other divs and make it dynamic with JS/JQuery?

    How to turn off carousel when resized?

    show css icon with select icon class selcetbox

    Weird behavior when I'm alternating between showing and hiding Flot graphs

    Responsive CSS: Replicating how Facebook's chat panel disappears below a certain browser window width

    How to inline style an embedded gist with CSS

    How to calculate rotation angle from rectangle points?