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粉5059175902024-03-30 12:11:04
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);
}