css (box-shadow) 页面加载时的过渡
css (box-shadow) transition on page load
有没有办法让页面加载时的框阴影发生过渡,而不是悬停或点击效果?
我想要在页面加载时或作为事件的过渡:
.item:hover{
margin:0 auto;
box-shadow: 1px 1px 20px grey;
transition: 0.7s;
max-width: 940px;
color: dimgrey;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 10px 10px 10px 10px;
}
- you can name
keyframes
a name and provide the time you need, I have provided4sec
in the example.
- It says change the background color from
red
to yellow
and increase the height
by 200px
and animate this for 4 seconds.
.item {
height: 100px;
width: 100px;
background-color: blue;
animation-name: animate;
animation-duration: 4s;
border-radius: 10px;
}
@keyframes animate {
from {
background-color: red;
}
to {
background-color: yellow;
height: 200px;
}
}
<div class="item">
</div>
有没有办法让页面加载时的框阴影发生过渡,而不是悬停或点击效果?
我想要在页面加载时或作为事件的过渡:
.item:hover{
margin:0 auto;
box-shadow: 1px 1px 20px grey;
transition: 0.7s;
max-width: 940px;
color: dimgrey;
padding-top: 10px;
padding-bottom: 10px;
border-radius: 10px 10px 10px 10px;
}
- you can name
keyframes
a name and provide the time you need, I have provided4sec
in the example.- It says change the background color from
red
toyellow
and increase theheight
by200px
and animate this for 4 seconds.
.item {
height: 100px;
width: 100px;
background-color: blue;
animation-name: animate;
animation-duration: 4s;
border-radius: 10px;
}
@keyframes animate {
from {
background-color: red;
}
to {
background-color: yellow;
height: 200px;
}
}
<div class="item">
</div>