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

Problem with a "hover" in one input[type="submit"]

Can anyone help me understand why my CSS styling is not being applied correctly to the input?

.html code
.CSS styles

I need to achieve a smooth transition with the CSS styles, but for some reason they are not being applied correctly.

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

<input type="submit" value="Submit" />

input[type="submit"] {
  background: #fff; 
  color: #4741d7;
  border: 2px solid #4741d7; 
  padding: 16px 20px;
  border-radius: 3px;
  position: relative;
  z-index: 1;
  overflow: hidden;
  display: inline-block;
  font-size: large;
  letter-spacing: 12px;
}
input[type="submit"]:hover {
  color: #fff;
}
input[type="submit"]::after {
  content: "";
  background-color: #4741d7; 
  position: absolute;
  z-index: -1;
  padding: 16px 20px;
  display: block;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transform: scale(0, 0) rotate(-180deg);
  transition: all 0.3s ease;
}
input[type="submit"]:hover::after {
  transition: all 0.3s ease-out;
  transform: scale(1, 1) rotate(0deg);
}

>Solution :

transition: all 0.3s ease add this property to input[type="submit"] this tag and remove it from input[type="submit"]::after and input[type="submit"]:hover::after

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