When I hover over the div, the .note span fades in. After it fades in, the font-weight seems to suddenly increase (it becomes bolder). I realize that in the fiddle there is no image, but it is not required to see my issue.
Html:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="script.js"></script>
<title>Cool Effect</title>
</head>
<body>
<div class="imageHolder">
<img src="picture1.jpeg">
<span class="note">Hello!</span>
</div>
</body>
</html>
CSS:
.imageHolder {
position: relative;
top:300px;
left: 300px;
width: 300px;
height: 250px;
text-align: center;
overflow: hidden;
background-color: black;
}
.note {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
border: 2px solid white;
padding: 8px;
color: white;
font-size: 24px;
opacity: 0;
-webkit-transition: opacity 0.5s;
transition: opacity 0.5s;
}
img {
width: 300;
opacity: 1;
height: 250px;
}
.imageHolder:hover .note {
opacity: 1;
}
Thanks.
Using a 3d transform (ie. using hardware acceleration) fixes lots of these rendering issues.
.note {
...
-webkit-transform: translate3d(-50%, -50%, 0);
transform: translate3d(-50%, -50%, 0);
...
}
This is well documented
DEMO
Alternatively, this also seems to work for your example and may have better browser support...
.note {
...
-webkit-backface-visibility: hidden;
...
}
DEMO
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