Make a div appear on hover over another div
Replace
#content:hover + #hoverbar{
visibility:visible;
}
with
#content:hover > #hoverbar{
visibility:visible;
}
or
#content:hover #hoverbar{
visibility:visible;
}
The plus sign '+' is for siblings. In your case the div is nested.
Here the updated jsfiddle
Using only CSS, show div on hover over another element
You can do something like this:
div { display: none;} a:hover + div { display: block;}
<a>Hover over me!</a><div>Stuff shown on hover</div>
How to display a div on hover on another div
You want one of the sibling selectors. General sibling ~
or next sibling +
.ClildDiv1:hover ~ .ChildDiv2 {
display: block;
}
See fiddle here
Or, the parent hover for any child div would be
.Parent:hover > div {
display: block;
}
Display a DIV on hover, over but within another DIV which is hovered over. With CSS
You can use position
property like this:
Html
<div class="book">
<div class="info">More info here</div>
<div class="image">
Image here
</div>
</div>
CSS
.book {
position:relative;
}
.info {
position:absolute;
top:0;
left:0;
z-index:1;
display:none;
}
.book:hover .info{
display:block;
}
The demo http://jsfiddle.net/6ReTK/10/
To get some effect you can use Jquery Fading methods or use CSS transitions:
info {
transition:opacity 1s;
opacity:0;
}
.book:hover .info{
opacity:1;
}
Another demo http://jsfiddle.net/6ReTK/12/
Show div on hover another div
<!DOCTYPE html>
<html>
<head>
<style>
#main {
position: relative;
}
.hide {
display: none;
position: absolute;
left: 40%;
background: rgb(90, 13, 13);
}
.myDIV:hover + .hide {
display: block;
color: red;
}
.myDIV {
border: 2px solid;
background: rgb(202, 100, 100);
cursor: pointer;
height: 15vh;
width: 97px;
display: block;
margin: auto;
text-align: center;
}
</style>
</head>
<body>
<div id="main">
<div class="myDIV">Hover over</div>
<div class="hide">
<p>Lorem ipsum dolor sit.</p>
<hr />
<p>Lorem ipsum dolor sit.</p>
</div>
</div>
</body>
</html>
Related Topics
CSS Background Images Not Loading
How to Use Both Rel="Preload" and Rel="Stylesheet" for the Same Tag
How to Force Inline-Block Elements to Wrap
Global Disable Magnifying Glass on iOS 9 in Meteor Cordova App
Set a Height Value on an Individual CSS Grid Row
How to Load CSS File Dynamically
Align Checkboxgroupinput Vertically and Horizontally
Putting Emoticons in Paragraphs Without Affecting 'Line-Height'
Image Button Displaying 'Submit Query' Over the Top of Image in Firefox
How to Make CSS Max Width in IE6 and 7
Easy Equal Height Divs Without JavaScript Possible
CSS Text Ellipsis When Using Variable Width Divs
There Is a 4Px Gap Below Canvas/Video/Audio Elements in HTML5
Setting Element Height in Responsive Layout
Do Images Load Faster in HTML or CSS
Styling Dropdowns (Select) Boxes
CSS3 Image Frame-Border Z-Index
:Before and :After Pseudo Elements on HTML Tag Is Wonky in Chrome