利用hover渐变,hover前后如果都是渐变则在hover前的css添加属性transition:
#test{
transition:all 1s;
background:red;
width:10px
}
#test{
width:100px
}
如果仅在hover时有渐变,hover后瞬间回到初始状态则在hover时加入transition:
#test{
background:red;
width:10px
}
#test:hover{
transition:all 1s;
width:100px
}