The ripple effect goes out of the box of the button, I don't want that, but I don't know how to get rid of it. Help please?
body { background-color: #ddd; }
.overknop {
position: relative;
border-radius: 0 50px 0 50px;
border: 1px solid white;
font-family: "Bebas Neue";
font-size: 28px;
color: #FFFFFF;
color: black;
padding: 20px;
width: 200px;
overflow: hidden;
text-align: center;
text-decoration: none;
cursor: pointer;
background-color: transparent;
transition-duration: 0.4s;
}
.overknop::after {
content: "";
background: #f1f1f1;
display: block;
position: absolute;
padding-top: 300%;
padding-left: 350%;
margin-left: -20px !important;
margin-top: -120%;
opacity: 0;
transition: all 0.8s;
}
.overknop:active::after {
padding: 0;
margin: 0;
opacity: 1;
transition: 0s;
}
<button >OVER</button>
Really don't know how to do it, couldn't find anything about it on the internet as well
CodePudding user response:
This works fine.
You should have forgot using overflow:hidden
in your code
.overknop {
position: relative;
border-radius: 0 50px 0 50px;
border: 1px solid white;
font-family: "Bebas Neue";
font-size: 28px;
color: #ffffff;
padding: 20px;
width: 200px;
text-align: center;
transition-duration: 0.4s;
text-decoration: none;
overflow: hidden;
cursor: pointer;
background-color: transparent;
}
.overknop:after {
content: "";
background: #f1f1f1;
display: block;
position: absolute;
padding-top: 300%;
padding-left: 350%;
margin-left: -20px !important;
margin-top: -120%;
opacity: 0;
transition-duration: 0.8s;
}
body {
background-color: skyblue;
text-align: center;
margin-top: 30vh;
}
.overknop:active:after {
padding: 0;
margin: 0;
opacity: 1;
transition: 0s;
}
<button >OVER</button>