主要涉及到了以下属性:
<span style="font-family:Comic Sans MS;">animation(webkit-animation),
@keyframes name (@-webkit-keyframes name),
transform,
transform-origin,
transition,
box-shadow(spread属性),
text-shadow
z-index
linear-gradient。
radial-gradient
background-image
</span>
首先html代码如下:
<span style="font-family:Comic Sans MS;"><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>纯CSS绘制打火机动画火焰特效</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body class="keBody">
<h1 class="keTitle">纯CSS3绘制打火机动画火焰特效</h1>
<div class="kePublic">
<div class="playground">
<div class="flame"></div>
<div class="lighterBody">
<div class="hover">hover me</div>
</div>
<div class="lid"></div>
</div>
<div class="clear"></div>
</div>
</body>
</html></span>
style.css文件如下:
<span style="font-family:Comic Sans MS;">@charset "utf-8";
body{
margin:0;
padding:0;
color:#333;
text-align:center;
font:12px "微软雅黑";
}
:before,:after{
position:absolute;
content:"";
}
.keBody{
background:url(../images/bodyBg.jpg) repeat #333;
}
.keTitle{
height:100px;
line-height:10