3
Making a simple CSS animation to increase the height
of a div
using transition: all
and a question has arisen. Look at the example:
div{
width: 100px;
height: 30px;
background: red;
transition: all 1s ease;
}
div:hover{
height: 100px;
}
<div>Passe o mouse</div>
I could use transition: height
, since I just want to apply the transition in height
, but also using the all
the result is the same, since the all
will apply the effect to any modified property (provided the property is supported to do so).
So it’s not always best to use the all
since it takes all properties? Use all
implies some disadvantage in relation to using a specific property in transition
(as height
, width
, background-color
etc.)? If this is indifferent, why not just use the all
in any event?
In addition to performance, the programmer may want the effect to be applied to certain properties and not to all, or to apply different effects to different properties
– Costamilam