Here I have some CSS:
#image-edges-beneath:hover{
background-color: blue;
}
#image-edges:hover{
background-color: blue;
}
#image-edges-beneat:hover:after{
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
border: 2px solid #F1FD6D;
}
#image-edges:hover:after{
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
border: 2px solid #F1FD6D;
}
However this does not work. The only thing which happens is that the background color has a transition while I want it to only change on hover, while the border I want to have a transition, so basically the border fades into the color while the background color changes color immediately upon hover. That's what I want to accomplish, but this doesn't work. :( Any ideas users?
But transitions are not just limited to use with :hover . You can animate CSS properties, thus use CSS transitions without hover. This is done via transitions using some other CSS techniques, a number of which I've outlined below. I've also included a demo for each example.
The first thing is to create a border with a transparent background. Then animate it over hover giving it a linear animation and an identifier name as animate. Now using keyframes we will animate the border. Make sure to apply color to only the top and right side of the border.
add margin:-1px; which reduces 1px to each side. or if you need only for side you can do margin-left:-1px etc. That was the best solution for me because, in my case, I set a 1px border to the orignal element and want to get, on hover, a thicker border (3px). Using margin: -2px; indeed works.
What you need to do is set which property you want to transistion properly. Currently you have it as "all" but it needs to be either "background-color" or "border-color" based on which you want to be transitioned.
transition: border-color 1s ease;
http://jsfiddle.net/u3Ahk/
You can do border effect in a lots of way. Apply the below css to the class which you gonna apply border effect and change the border style on any event occurs.
-webkit-transition: border 3s ease;
-moz-transition: border 3s ease;
-o-transition: border 3s ease;
-ms-transition: border 3s ease;
transition: border 3s ease;
Also refer these links for advance border effects
https://codepen.io/giana/pen/yYBpVY
http://cssdeck.com/labs/10-crazy-effects-with-css3-border-transitions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With