I am trying to make a row of three buttons. One of the buttons has a :hover
property that makes its margin-top increase. This looks something like this:
button {
position: relative;
height: 45px;
width: 150px;
margin: 10px 8px;
padding: 5px 5px;
font-weight: 700;
font-size: 15px;
letter-spacing: 2px;
color: #383736;
border: 2px #383736 solid;
border-radius: 4px;
text-transform: uppercase;
outline: 0;
overflow:hidden;
background: none;
z-index: 1;
cursor: pointer;
transition: 0.15s;
}
button:hover {
color: whitesmoke;
}
.btn:hover:before {
right: 0;
}
.btn:before {
content: "";
position: absolute;
background: #383736;
bottom: 0;
left: 0;
right: 100%;
top: 0;
z-index: -1;
transition: right .15s;
}
.btn2:hover:before {
top: 0;
}
.btn2:before {
content: "";
position: absolute;
background: #383736;
bottom: 0;
left: 0;
top: 100%;
right: 0;
z-index: -1;
transition: top .15s;
}
.continue {
border-color: lime;
color: lime;
}
.continue:before {
content: "";
background-color: lime;
}
.continue:hover {
padding-top: 20px;
}
.continue:hover:before {
content: "\2192";
}
<button class = "btn">
HOVER
</button>
<button class = "btn2">
HOVER
</button>
<button class = "btn continue">
CONTINUE
</button>
When you hover the third button, it's padding-top changes and therefore the other two buttons move down. What can I do to make it so that this has the same effect, except the other two buttons don't move?
Aucun commentaire:
Enregistrer un commentaire