Gibt es eine bessere Version dieser Schaltfläche oder eine weniger verzögerte?Code für CSS nur Schaltfläche wie folgt? Ein anderer Weg um diesen Stil?
Ich habe versucht, genau diese Art von Stil Knopf zu finden, aber ich kann nicht. Dies ist ein sehr schlechter Versuch, der stark überarbeitet werden muss, da ich nicht von Anfang an über das richtige Styling nachgedacht habe.
Alle Links oder effizienteren Code stark
geschätzt würdeIch habe einen ähnlichen Code aber es ist nur diese genaue Art der Linien im Grunde um die Schaltfläche gezogen und entfernt wird gesehen, dass Ich mag würde (dies ist nur ein Streifzug wegen der „Anforderung“, um mehr einer Beschreibung als Code haben)
.UnderlineButton {
\t border: none;
\t background-color: white;
\t position: relative;
\t border: 2px solid;
\t border-top-color: rgb(255,255,255);
\t border-right-color: rgb(255,255,255);
\t border-left-color: rgb(255,255,255);
\t border-bottom-color: rgb(255,255,255);
padding: 10px;
\t padding-top: 20px;
padding-bottom: 0;
\t cursor: pointer;
\t
\t -webkit-animation: UnderlineButton .5s forwards;
}
\t @-webkit-keyframes UnderlineButton {
\t \t 0% {
\t \t \t padding-top: 10px;
\t \t \t padding-bottom: 10px;
\t \t \t border-right-color: red;
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t \t border-top-color: red;
\t \t \t border-left-color: red;
\t \t }
\t \t 19% {
\t \t \t border-right-color: red;
\t \t }
\t \t 20% {
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t \t border-top-color: red;
\t \t \t border-left-color: red;
\t \t }
\t \t 39% {
\t \t \t border-top-color: red;
\t \t }
\t \t 40% {
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-left-color: red;
\t \t }
\t \t 59% {
\t \t \t border-left-color: red;
\t \t }
\t \t 60 {
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-left-color: rgb(255,255,255);
\t \t }
\t \t 100% {
\t \t \t padding-top: 20px;
\t \t \t padding-bottom: 0;
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-left-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t }
\t
\t .UnderlineButton:hover {
\t \t -webkit-animation: UnderlineButtonHover .5s forwards;
\t }
\t
\t @-webkit-keyframes UnderlineButtonHover {
\t \t 0% {
\t \t \t padding-top: 20px;
\t \t \t padding-bottom: 0;
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-left-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t \t 20% {
\t \t \t padding-top: 20px;
\t \t \t padding-bottom: 0;
\t \t \t border-right-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-left-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t \t 39% {
\t \t \t border-right-color: rgb(255,255,255);
\t \t }
\t \t 40% {
\t \t \t border-right-color: red;
\t \t \t border-left-color: rgb(255,255,255);
\t \t \t border-top-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t \t 59% {
\t \t \t border-top-color: rgb(255,255,255);
\t \t }
\t \t 60% {
\t \t \t border-right-color: red;
\t \t \t border-top-color: red;
\t \t \t border-left-color: rgb(255,255,255);
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t \t 79% {
\t \t \t border-left-color: rgb(255,255,255);
\t \t }
\t \t 80% {
\t \t \t border-right-color: red;
\t \t \t border-top-color: red;
\t \t \t border-left-color: red;
\t \t \t border-bottom-color: rgb(255,255,255);
\t \t }
\t \t 99% {
\t \t \t border-bottom-color: red;
\t \t }
\t \t 100% {
\t \t \t padding-top: 10px;
\t \t \t padding-bottom: 10px;
\t \t \t border-right-color: red;
\t \t \t border-bottom-color: red;
\t \t \t border-top-color: red;
\t \t \t border-left-color: red;
\t \t }
\t }
\t .UnderlineButton:before {
\t \t position: absolute;
\t \t bottom: -2px;
\t \t background-color: red;
\t \t width: 80%;
\t \t height: 2px;
\t \t content: "";
\t \t right: 10%;
\t \t -webkit-animation: UnderlineButtonBefore .5s forwards;
\t }
\t
\t \t @-webkit-keyframes UnderlineButtonBefore {
\t \t \t 0% {
\t \t \t \t top: 100%;
\t \t \t \t width: 100%;
\t \t \t \t left: 0;
\t \t \t \t right: 0;
\t \t \t \t height: 2px;
\t \t \t }
\t \t \t 20% {
\t \t \t \t left: 100%;
\t \t \t \t right: 0;
\t \t \t \t height: 2px;
\t \t \t \t width: 2px;
\t \t \t \t top: 100%;
\t \t \t }
\t \t \t 21% {
\t \t \t \t top: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 100%;
\t \t \t \t right: 0;
\t \t \t \t left: 100%;
\t \t \t }
\t \t \t 40% {
\t \t \t \t top: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 2px;
\t \t \t \t right: 0;
\t \t \t \t left: 100%;
\t \t \t }
\t \t \t 41% {
\t \t \t \t top: -2px;
\t \t \t \t width: 100%;
\t \t \t \t height: 2px;
\t \t \t \t right: 0;
\t \t \t \t left: 0;
\t \t \t }
\t \t \t 60% {
\t \t \t \t top: -2px;
\t \t \t \t width: 2px;
\t \t \t \t height: 2px;
\t \t \t \t left: 0;
\t \t \t }
\t \t \t 61% {
\t \t \t \t top: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 100%;
\t \t \t \t left: -2px;
\t \t \t \t bottom: 0;
\t \t \t }
\t \t \t 80% {
\t \t \t \t top: 100%;
\t \t \t \t bottom: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 0;
\t \t \t \t left: -2px;
\t \t \t \t bottom: 0;
\t \t \t }
\t \t \t 90% {
\t \t \t \t bottom: -2px;
\t \t \t \t left: 0;
\t \t \t \t width: 0;
\t \t \t \t height: 2px;
\t \t \t }
\t \t \t 100% {
\t \t \t \t right: 10%;
\t \t \t \t left: 10%;
\t \t \t \t width: 80%;
\t \t \t \t bottom: -2px;
\t \t \t \t height: 2px;
\t \t \t }
\t \t }
\t
\t .UnderlineButton:hover:before {
\t \t -webkit-animation: UnderlineButtonBeforeHover .5s forwards;
\t }
\t
\t \t @-webkit-keyframes UnderlineButtonBeforeHover {
\t \t \t 0% {
\t \t \t \t right: 10%;
\t \t \t \t width: 80%;
\t \t \t \t left: 10%;
\t \t \t }
\t \t \t 20% {
\t \t \t \t right: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 2px;
\t \t \t \t bottom: -2px;
\t \t \t \t left: 100%;
\t \t \t }
\t \t \t 21% {
\t \t \t \t right: 0;
\t \t \t \t width: 2px;
\t \t \t \t height: 2px;
\t \t \t \t top: 100%;
\t \t \t \t
\t \t \t }
\t \t \t 40% {
\t \t \t \t width: 2px;
\t \t \t \t height: 100%;
\t \t \t \t top: 0;
\t \t \t \t right: -2px;
\t \t \t }
\t \t \t 41% {
\t \t \t \t top: -2px;
\t \t \t \t height: 2px;
\t \t \t \t width: 2px;
\t \t \t \t left: 100%;
\t \t \t }
\t \t \t 60% {
\t \t \t \t width: 100%;
\t \t \t \t height: 2px;
\t \t \t \t left: 0;
\t \t \t \t top: -2px;
\t \t \t }
\t \t \t 61% {
\t \t \t \t width: 2px;
\t \t \t \t height: 2px;
\t \t \t \t top: -2px;
\t \t \t \t left: -2px;
\t \t \t }
\t \t \t 80% {
\t \t \t \t height: 100%;
\t \t \t \t width: 2px;
\t \t \t \t top: -2px;
\t \t \t \t left: -2px;
\t \t \t }
\t \t \t 81% {
\t \t \t \t height: 2px;
\t \t \t \t width: 2px;
\t \t \t \t bottom: -2px;
\t \t \t \t left: -2px;
\t \t \t \t top: 100%;
\t \t \t }
\t \t \t 100% {
\t \t \t \t top: 100%;
\t \t \t \t width: 100%;
\t \t \t \t left: 0;
\t \t \t \t height: 2px;
\t \t \t }
\t \t }
<div style="padding: 40px; background-color:rgb(252,252,252);">
<button class="UnderlineButton">Underline</button>
</div>
Was ist Ihre Frage genau? Was funktioniert nicht so, wie du es erwartest? – jmargolisvt
Es sieht sehr lückig aus, ich hätte gerne eine bessere Version dieses Buttons. Sorry für die Verwirrung – lllllllllllllIllllIll
FWIW, keine Verzögerung zu sehen. Sieht gut aus für mich. – jmargolisvt