1

I have button transformation on hover in my custom stylesheet. It allows me to create button from <a href> or <div>. During this transformation font is blinking in strange way. Could you kindly tell me why and how to solve it?

Here is the scss code: https://gist.github.com/rafpiek/7e1b2df5690baa3b02e88eee10adfb98

and the video: https://www.youtube.com/watch?v=4c4D96FukuQ&feature=youtu.be

.button {
  text-decoration: none;
  color: #ECECEC;
  font-size: 20px;
  height: 40px;
  width: 100px;
  background: #B3595F;
  display: inline-block;
  transition: all 0.30s linear;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 5px 3px;
  cursor: pointer;
  border-radius: 6px;
  user-select: none;
  font-weight: bold;
}
.button:-webkit-any-link {
  color: #ECECEC;
}
.button:hover {
  transform: scale(1.07);
  color: #ECECEC;
}
.button:active, .button:focus, .button:visited {
  text-decoration: none;
  color: #ECECEC;
}
.button.blue {
  background-color: #2C92FF;
}
.button.red {
  background-color: #FF2113;
}
.button.green {
  background-color: #1EBE32;
}
<button class="button">button</button>
Michael Coker
  • 52,626
  • 5
  • 64
  • 64
  • Possible duplicate of [How to prevent Webkit text rendering change during CSS transition](http://stackoverflow.com/questions/12502234/how-to-prevent-webkit-text-rendering-change-during-css-transition) – Francesco Feb 06 '17 at 17:27

3 Answers3

1

Try this in .button:

-webkit-font-smoothing: antialiased;

Gergely Papp
  • 800
  • 1
  • 7
  • 12
0

This is caused AFAIK from the browser changing the text antialias type during the animation (new GPU implicit layer).

More info on causes and fixes here -> How to prevent Webkit text rendering change during CSS transition

Community
  • 1
  • 1
Francesco
  • 555
  • 4
  • 23
0

Can be reduced using perspective and 3d scale:

transform: perspective(1px) scale3d(1.07,1.07,1);

Alejalapeno
  • 1,008
  • 7
  • 11