Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I limit the ripple effect to the border of my button?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading