2017-11-30 6 views
2

Wenn der Benutzer über meine Schaltfläche schwebt, gibt es eine Farbe von links nach rechts. Wenn ich es schwebe, flimmert es etwas, anstatt einen fließenden Übergang zu haben.CSS-Übergang flackert

Wie kann ich das Problem lösen?

.slide_right:hover { 
 
    box-shadow: inset 400px 0 0 0 #D80286; 
 
} 
 

 
.button_slide { 
 
    color: #FFF; 
 
    border: 2px solid rgb(216, 2, 134); 
 
    border-radius: 0px; 
 
    padding: 18px 36px; 
 
    display: inline-block; 
 
    font-family: "Lucida Console", Monaco, monospace; 
 
    font-size: 14px; 
 
    letter-spacing: 1px; 
 
    cursor: pointer; 
 
    box-shadow: inset 0 0 0 0 #D80286; 
 
    -webkit-transition: ease-out 0.4s; 
 
    -moz-transition: ease-out 0.4s; 
 
    transition: ease-out 0.4s; 
 
}
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE">

View on JSFiddle

+0

Mögliche Duplikat [Box-Schatten schweben Übergang Blinzeln] (https://stackoverflow.com/questions/47168067/box-shadow-hover-transition-blinking) – showdev

+0

Siehe auch [ Wie man "box-shadow" animiert (http://tobiasahlin.com/blog/how-to-animate-box-shadow/) – showdev

+1

Siehe auch [Wie man das Flimmern von der CSS-Schaltflächenanimation entfernt?] (Https: // stackoverflow.com/questions/45287718/how-to-remove-flicker-from-css-button-animation) – showdev

Antwort

1

einfach eine sehr geringe Streuung Radius auf den Anfangsfeld Schattenwert hinzuzufügen. In diesem Fall box-shadow: inset 0 0 0 0.01px #D80286;.

.slide_right:hover { 
 
    box-shadow: inset 400px 0 0 0 #D80286; 
 
} 
 

 
.button_slide { 
 
    color: #FFF; 
 
    border: 2px solid rgb(216, 2, 134); 
 
    border-radius: 0px; 
 
    padding: 18px 36px; 
 
    display: inline-block; 
 
    font-family: "Lucida Console", Monaco, monospace; 
 
    font-size: 14px; 
 
    letter-spacing: 1px; 
 
    cursor: pointer; 
 
    box-shadow: inset 0 0 0 0.01px #D80286; 
 
    -webkit-transition: ease-out 0.4s; 
 
    -moz-transition: ease-out 0.4s; 
 
    transition: ease-out 0.4s; 
 
}
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE"> 
 
<input type="button" class="button_slide slide_right" value="BUTTON: SLIDE INSIDE">