Tilt effect bug on hover
P粉520545753
P粉520545753 2024-03-29 13:34:50
0
1
293

I have a button with a tilt effect that has a text inside it and when I hover the button two lines appear next to the button.

There is code, Hover over the button until you see it , it's a very random side effect.

I think this is a Chrome issue, but I'm not sure. Here is a picture of the problem: https://prnt.sc/hafHhDOHntco

.button-skew {
  position: relative;
  width: fit-content;
  padding: 6px 40px;
  border-radius: 5px;
  transform: skewX(-7.5deg);
  background: blue;
  transition: all 0.35s cubic-bezier(.47, 1.64, .41, .8);
}

.button-skew:hover {
  padding: 6px 60px;
  transform: skewX(-7.5deg);
  background: red;
  transition: all 0.35s cubic-bezier(.47, 1.64, .41, .8);
}

p {
  position: relative;
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: 0em;
  text-align: center;
  color: white;
  transform: skewX(7.5deg);
}
<div class="button-skew">

  <p>Contact us</p>

</div>

P粉520545753
P粉520545753

reply all(1)
P粉505917590

Hmm..This is indeed a rendering error. I found a line of CSS that seemed to be a workaround, but it made the button text a bit blurry on my system. This might be what you're looking for.

It is said to change the browser animation optimization of elements.

will-change: transform;

See the code snippet below, which no longer displays the lines:

.button-skew {
  position: relative;
  width: fit-content;
  padding: 6px 40px;
  border-radius: 5px;
  transform: skewX(-7.5deg);
  background: blue;
  transition: background 0.35s cubic-bezier(.47, 1.64, .41, .8),
  padding 0.35s cubic-bezier(.47, 1.64, .41, .8);
  
  will-change: transform;
}

.button-skew:hover {
  padding: 6px 60px;
  background: red;
}

p {
  position: relative;
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  letter-spacing: 0em;
  text-align: center;
  color: white;
  transform: skewX(7.5deg);
}

Contact us

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!