I wanted to hide some rating text on the page until I hovered over it.
I am novice css + javascript coder and I was testing some css override code (eg using a chrome browser with stylebot extension) when viewing a web, which means you can only modify css. I did not find a way to do this with css visibility attribute but using opacity works fine see code shown below. I could not find anything that explains why css visibility will not change when I hover over the area. Just curious if anyone can explain it. Is it possible to do with visibility in only css?
If I were doing visibility changes via javascript would this behavior be identical as pure css? I saw few questions on stackoverflow.com asking what looked like similar questions but did follow them. Just curious.
(Edit: I first tried display then tried visibility. I realize space is kept with visibility but is hover disabled?).
<!DOCTYPE html>
<html>
<head>
<style>
div.mydiv1 {
visibility:hidden;
}
div.mydiv1:hover {
visibility:visible;
}
div.ratingValue {
opacity: 0
}
div.ratingValue:hover {
opacity:1;
}
</style>
</head>
<body>
Opacity:
<div class=ratingValue>
Opacity example
<p />
</div>
Visibility:
<div class=mydiv1>
Visibility example
</div>
</body>
</html>