Hi, I would like to make the button interactive and when I click on the button it will offset down.
I’ve set the .btn:active
to margin-top: 4px
, it supposed to move downwards when I clicked on it. However, I’ve clicked on the button and it wouldn’t move down, it just removed to box-shadow
. I would appreciate if someone can help me with this problem, thank you!
This is the picture with .btn
:
This is the picture with .btn:hover
:
This is the picture with .btn:active
:
My CSS code are as below:
.btn {
text-decoration: none;
font-family: 'Raleway', sans-serif;
color: #f2f2f2;
border: 1px solid #f2f2f2;
padding: 10px;
border-radius: 10px;
box-shadow: 0px 4px;
}
.btn:hover {
background-color: #f2f2f2;
color: #2176FF;
transition: color .1s ease-in, background-color .1s ease-in;
}
.btn:active {
margin-top: 4px;
box-shadow: 0px 0px;
}