0

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 class="overknop">OVER</button>

Really don't know how to do it, couldn't find anything about it on the internet as well

Dai
  • 141,631
  • 28
  • 261
  • 374
Zenon
  • 3
  • 3
  • We can't help you because you haven't posted any HTML using your `overknop` CSS class (also, [you really should not be using `transition: all`: you should use an explicit list of transitioned properties instead](https://stackoverflow.com/questions/8947441/css3-transitions-is-transition-all-slower-than-transition-x)). – Dai Mar 22 '22 at 08:27
  • ```

    ``` that's really all of the html

    – Zenon Mar 22 '22 at 08:32

1 Answers1

0

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 class="overknop">OVER</button>
Musafiroon
  • 623
  • 6
  • 20