Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I make this font size small smoothly without jumps?

I'm trying to reduce the size of the font gradually. But it looks like it shakes while turning small. How to make it look smooth?

.name:hover {
  color: green;
  transition-property: font-size;
  transition-duration: 2s;
  transition-timing-function: ease;
  font-size: 5px;
}
<div class="name">Name</div>
like image 595
Deke Avatar asked Mar 06 '23 23:03

Deke


1 Answers

Use a transform:scale instead:

.name {
    transition: transform 2s;
    transform-origin: left
}
.name:hover {
    color: green;
    transform: scale(0.5);
}
<div class="name">Name</div>
like image 143
stelioslogothetis Avatar answered May 05 '23 06:05

stelioslogothetis