I would like to display the contents of my div extra_infowhen I hover over an image of a dog.
extra_info
I saw syntax like:
.circular:hover + div.extra_info { display:absolute; }
However, I canβt get it to work!Here is my code:
.circular { margin-top: 50px; position: relative; z-index: 199 !important; float: left; display: block; width: 50px; height: 50px; border-radius: 50%; border: 2px solid #ffffff; } .circular:hover { border: 2px solid #16D3AE; } .extra_info { display: none; }
<img src=http://officialhuskylovers.com/wp-content/uploads/2015/05/Cute-dog-listening-to-music-1_1.jpg class="circular"> <div class="extra_info"> <h3>A lovely doggy woggy</h3> </div>
View in JSFiddle
You can use or in this case you can also use hereAdjacent sibling selector +General sibling selector ~Fiddle
Adjacent sibling selector
+
General sibling selector
~
Fiddle
.circular { margin-top:50px; position: relative; z-index:199 !important; float:left; display:block; width: 50px; height: 50px; border-radius: 50%; border:2px solid #ffffff; } .circular:hover{ border:2px solid #16D3AE; } .extra_info{ display:none; } .circular:hover + .extra_info { display: block; }
div.extra_info{ display: none; } a:hover + div.extra_info{ display: block; }
This will work as follows.
<a>Content</a> <div>Content display on hover</div>
div can be created by a child anchor.
div
Source: https://habr.com/ru/post/1626567/More articles:Why errno when the POSIX function indicates an error state by returning -1 or NULL - cSelectSingleNode gives compilation error in dnx core 5.0 - selectsinglenodeTwo sea slots on the same axis - pythonElectron How to create a menu in the main process? - javascriptXcode 7.2 Syntax Flicker Highlighting in Swift Files - editorerror in context FLAG_ACTIVITY_NEW_TASK - javaHow to build a route that has `#`? - angularjsspring -cloud-consul: cannot override default values ββin ConsulProperties - spring-bootCreating internal functions (cannot be called from the console) in R - rforced full error when using RTL - javascriptAll Articles