How can I display a block/text when a user hovers or clicks on an image?
I found a few good posts.
I also found external sources. Each place I went provided a solution similar to this:
HTML
<a id="thumbnail" href="#"><img src="http://dummyimage.com/150x150/0066ff/fff"></a>
<div id="title">filename.jpg</div>
CSS
#thumbnail {
display: block;
width: 150px;
height: 150px;
}
#thumbnail:hover + #title {
display: block;
}
#title {
display: none;
color: #ffffff;
background-color: #000000;
text-align: center;
width: 130px;
padding: 10px;
}
I don't understand what I'm doing wrong in my code though. Here's what I have:
Html
<div class="sqs-block image-block sqs-block-image" data-block-type="5"
id="block-yui_3_17_2_2_1428673541254_6455"> </div>
<div class="sqs-block html-block sqs-block-html" data-block-type="2"
id="block-yui_3_17_2_3_1429198468651_10272"><div class="sqs-block-content">
<p>I want this text to appear when the calendar image is hovered (and
preferably clicked too)</p></div>
CSS
#block-yui_3_17_2_2_1428673541254_6455 {
display: block !important;
}
#block-yui_3_17_2_2_1428673541254_6455:hover +
#block-yui_3_17_2_3_1429198468651_10272 {
display: block !important;
}
#block-yui_3_17_2_3_1429198468651_10272 {
display: none;
color: #ffffff;
background-color: #000000;
text-align: center;
width: 130px;
padding: 10px;
}
I literally just swapped out the selectors to match what I want done: When a user hovers over the calendar image on the right, I'd like text to appear on the left. I've tried other solutions, similar to this with no luck. Any ideas where I'm going wrong?