We want to hide button until we hover over the div layer.
FIDDLE here > Click to view
Essentially, I would like to be able to apply this to other elements also, but this will do for now, any help appreciated
You can do this by using the :hover property of a page element. For example, if we have a div inside another div, we can check the hover of the outer div to show/hide the inner div. This CSS hides the inner div by default using "display: none;".
To display div element using CSS on hover a tag: First, set the div element invisible i.e display:none;. By using the adjacent sibling selector and hover on a tag to display the div element.
If you have two elements in your HTML and you want to :hover over one and target a style change in the other the two elements must be directly related--parents, children or siblings. This means that the two elements either must be one inside the other or must both be contained within the same larger element.
Simply use the :hover
pseudo-class on the outer div:
.resultContainer .viewThisResult {
display: none;
}
.resultContainer:hover .viewThisResult {
display: inline;
}
Here's the fiddle: http://jsfiddle.net/dTLaF/1/
.resultContainer:hover .viewThisResult { display: block; }
:hover
pseudoselector on the parent. Though it's nice when the code for the question is included in the question, for posterity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With