CSS部分:
首先设置div的长和高为120px,然后将border-radius:设为50%,使其变为圆形,用border: 16px solid #f3f3f3设置圆圈的宽度和颜色,最后通过 border-top属性,设置一个可以滚动的部分。基本样式完成以后,就是用CSS3中的animation动画,让其无限循环转动,具体代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>css3 loading</title>
<style>
.loading{
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #02b2c9;
width: 120px;
height: 120px;
-webkit-animation: spin 2s linear infinite;
animation