CSS - Blurry image/text when rezising

1.5k views Asked by At

I'm making a hover effect on my website, where you hover images (pngs) and they grow in size. The problem i have is that they now get blurry when they resize.

The code that I'm using looks something like this:

.div {
-webkit-transition: -webkit-transform 0.35s;
transition: transform 0.35s;
-webkit-transform: perspective(1000px) translate3d(0,0,1px);
transform: perspective(1000px) translate3d(0,0,0);
}

.div:hover {
-webkit-transform: perspective(100px) translate3d(0,0,1px);
transform: perspective(100px) translate3d(0,0,31px);

}

And you can see the effect on this jsfiddle: enter link description here

Is there a way to fix this?

1

There are 1 answers

2
jaunt On BEST ANSWER

I think scale would be more appropriate for this. This solution only blurs during scaling.

.square {
  width:100px;
  height: 100px;
  background-color:black;
  margin: 50px;
}
p {
  color:white;
  text-align: center;
  padding-top: 35px;
}
.square {
  -webkit-transition: -moz-transform .3s ease-out; 
  -moz-transition: -webkit-transform .3s ease-out; 
  -o-transition: -o-transform .3s ease-out; 
  transition: transform .3s ease-out; 
}
.square:hover {
  -webkit-transform: scale(2);  
  -moz-transform: scale(2);    
  -o-transform: scale(2);
  transform: scale(2);
}
<div class="square">
  <p>Some text</p>                        
</div>