It's a pretty straightforward question but I can't find very good documentation on the CSS transition properties. Here is the CSS snippet:
.nav a
{
text-transform:uppercase;
text-decoration:none;
color:#d3d3d3;
line-height:1.5 em;
font-size:.8em;
display:block;
text-align:center;
text-shadow: 0 -1.5em 0 rgba(255, 255, 255, 0.15);
-webkit-transition: color .2s linear;
-moz-transition: color .2s linear;
-o-transition: color .2s linear;
transition: color .2s linear;
-webkit-transition: text-shadow .2s linear;
-moz-transition: text-shadow .2s linear;
-o-transition: text-shadow .2s linear;
transition: text-shadow .2s linear;
}
.nav a:hover
{
color:#F7931E;
text-shadow: 0 1.5em 0 rgba(247, 147, 30, 0.15);
}
As you can see, the transition properties are overwriting eachother. As it stands, the text-shadow will animate, but not the color. How do I get them both to simultaneously animate? Thanks for any answers.
Something like the following will allow for multiple transitions simultaneously:
Example: http://jsbin.com/omogaf/2
If you make all the properties animated the same, you can set each separately which will allow you to not repeat the code.
There is more about it here: CSS transition shorthand with multiple properties?
I would avoid using the property all (transition-property overwrites 'all'), since you could end up with unwanted behavior and unexpected performance hits.
Transition properties are comma delimited in all browsers that support transitions:
ease
is the default timing function, so you don't have to specify it. If you really wantlinear
, you will need to specify it:This starts to get repetitive, so if you're going to be using the same times and timing functions across multiple properties it's best to go ahead and use the various
transition-*
properties instead of the shorthand:Here's a LESS mixin for transitioning two properties at once:
You can also simply significantly with: