If you have several specific properties that you want to transition in the same way (because you also have some properties you specifically don't want to transition, say opacity
), another option is to do something like this (prefixes omitted for brevity):
.myclass {
transition: all 200ms ease;
transition-property: box-shadow, height, width, background, font-size;
}
The second declaration overrides the all
in the shorthand declaration above it and makes for (occasionally) more concise code.
/* prefixes omitted for brevity */_x000D_
.box {_x000D_
height: 100px;_x000D_
width: 100px;_x000D_
background: red;_x000D_
box-shadow: red 0 0 5px 1px;_x000D_
transition: all 500ms ease;_x000D_
/*note: not transitioning width */_x000D_
transition-property: height, background, box-shadow;_x000D_
}_x000D_
_x000D_
.box:hover {_x000D_
height: 50px;_x000D_
width: 50px;_x000D_
box-shadow: blue 0 0 10px 3px;_x000D_
background: blue;_x000D_
}
_x000D_
<p>Hover box for demo</p>_x000D_
<div class="box"></div>
_x000D_