「CSS3」@keyframes,@-moz-keyframes,@-webkit-keyframesの使い方

使用例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>css3 sample</title> 
<style> 
div
{
      width:100px;
      height:100px;
      background:red;
      animation:myfirst 5s;
      -moz-animation:myfirst 5s; /* Firefox */
      -webkit-animation:myfirst 5s; /* Safari and Chrome */
      -o-animation:myfirst 5s; /* Opera */
}

@keyframes cftfirst
{
      0%   {background:red;}
      25%  {background:yellow;}
      50%  {background:blue;}
      100% {background:green;}
}

@-moz-keyframes cftfirst /* Firefox */
{
      0%   {background:red;}
      25%  {background:yellow;}
      50%  {background:blue;}
      100% {background:green;}
}

@-webkit-keyframes cftfirst /* Safari and Chrome */
{
      0%   {background:red;}
      25%  {background:yellow;}
      50%  {background:blue;}
      100% {background:green;}
}

@-o-keyframes cftfirst /* Opera */
{
      0%   {background:red;}
      25%  {background:yellow;}
      50%  {background:blue;}
      100% {background:green;}
}
</style>
</head>
<body>

<div></div>

<p><b>111:</b>2222</p>
</body>
</html>

 

CSS

Posted by arkgame