CSS Hover on Div Container; Display Image

时间:2016-02-12 22:05:16

标签: html css

I need an image to appear when the overall container is hovered. I've tried accessing the class directly on the image and I've tried nesting the image in a div with no success. I have a feeling it is regarding the selectors ~, >, etc. but I cannot track this down for the life of me.

Here is my HTML Code:

def get_interesting_elements(L)
    return filter(lambda x: my_criteria(x) == True, L)

Here is the CSS:

<div class="container">
  <div class="info">
    <div class="sigma">
      <img src="http://www.wrightslaw.com/blog/wp-content/plugins/wpdiscuz/assets/img/plugin-icon/icon_info.png" align="right" style="margin: 7px 0;"  />
    </div>      
  </div>
  <div id="chart1" style=""></div>
</div>

I also have a JSFiddle: http://jsfiddle.net/sthompson/eovn8o3p/2/

3 个答案:

答案 0 :(得分:2)

npm i jquery is not a sibling of the sigma, so the container combinator in your selector is not appropriate. Neither is it an immediate child, so you should use just a simple selector instead:

~

Updated fiddle

答案 1 :(得分:2)

Remove the general sibling selector, const auto separator = "WhatYouWantHere"; const auto* sep = ""; for(const auto& item : items) { std::cout << sep << item; sep = separator; }

jsFiddle example

~ is a descendant (grandchild) of .sigma and .container only applies to siblings. If for some reason you need to enforce the hierarchy, you could also use ~.

答案 2 :(得分:1)

I think this is what you are looking for: http://jsfiddle.net/eovn8o3p/5/

    StringRandomize.countries.add("USA");
    StringRandomize.countries.add("GB");
    StringRandomize.countries.add("Germany");
    StringRandomize.countries.add("Austria");
    StringRandomize.countries.add("Romania");
    StringRandomize.countries.add("Moldova");
    StringRandomize.countries.add("Ukraine");