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

border transition in css

I want to add transition animations to a border
I am using SCSS :

display: flex;
&:hover{
border: 1px solid rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
transition: border 1s ease;
}

This code didn’t work , I need a way to add the transitions but I don’t know how !

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 :

The browser doesn’t know how to change from a colour that isn’t set, so you simply need a colour to transition from. In this case I’ve used transparent:

div {
  border: transparent;
  &:hover{
    border: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
    transition: border 1s ease;
  }
}
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