Home > Web Front-end > HTML Tutorial > css3中为什么要定位,动画才能动?_html/css_WEB-ITnose

css3中为什么要定位,动画才能动?_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:36:02
Original
1425 people have browsed it

div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s;
}

@keyframes myfirst
{
0%   {background:red; left:0px; top:0px;}
25%  {background:yellow; left:200px; top:0px;}
50%  {background:blue; left:200px; top:200px;}
75%  {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}


回复讨论(解决方案)

设置了left、top 才能生效

css本来就是只有设置了position,left和top才能生效的

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template