CSS3----画圆,渐变,旋转

12 篇文章 2 订阅
9 篇文章 0 订阅

效果图:

 

使用border-radius,你可以画出各种漂亮的圆形图案

CSS

 

.circle {
    border-radius: 50%;
    display: inline-block;
    margin-right: 20px;
}

#circle1 {
    width: 200px;
    height: 200px;
    background: green;
}

#circle2 {
    width: 125px;
    height: 125px;
    background: red;
}

#circle3 {
    width: 100px;
    height: 100px;
    background: blue;
    position: relative;
}

#circle4 {
    width: 80px;
    height: 80px;
    background: orange;
    position: absolute;
    top: 10%;
    left: 10%;
    display: block;
}

#circle5 {
    width: 60px;
    height: 60px;
    background: white;
    position: absolute;
    top: 13%;
    left: 13%;
    display: block;
}

/*旋转*/
@-webkit-keyframes spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

@-moz-keyframes spin {
    from { -moz-transform: rotate(0deg); }
    to { -moz-transform: rotate(360deg); }
}

@-ms-keyframes spin {
    from { -ms-transform: rotate(0deg); }
    to { -ms-transform: rotate(360deg); }
}

/*渐变色效果的圆形图案*/
#advanced {
    width: 200px;
    height: 200px;
    
    background-image: -moz-radial-gradient(45px 45px 45deg, circle cover, yellow 0%, orange 100%, red 95%);
    background-image: -webkit-radial-gradient(45px 45px, circle cover, yellow, orange,red);
    background-image: radial-gradient(45px 45px 45deg, circle cover, yellow 0%, orange 100%, red 95%);
    
    
    /* webkit chrome, safari, mobile */
        -webkit-animation-name: spin; 
        -webkit-animation-duration: 3s; /* 3 seconds */
        -webkit-animation-iteration-count: infinite;   /*1:1圈*/
        -webkit-animation-timing-function: linear;

        /* mozilla ff */
        -moz-animation-name: spin; 
        -moz-animation-duration: 3s; /* 3 seconds */
        -moz-animation-iteration-count: infinite;    <span style="font-family: Arial, Helvetica, sans-serif;">/*1: 1圈*/</span>

        -moz-animation-timing-function: linear;

        /* microsoft ie */
        -ms-animation-name: spin; 
        -ms-animation-duration: 3s; /* 3 seconds */ 
        -ms-animation-iteration-count: infinite;  <span style="font-family: Arial, Helvetica, sans-serif;">/*1:1圈*/</span>
        -ms-animation-timing-function: linear;
}


HTML

 

 

<h2>基本圆形</h2>
<div id="circle1" class="circle lazy "></div>
<div id="circle2" class="circle lazy "></div>
<div id="circle3" class="circle lazy ">
    <div id="circle4" class="circle lazy ">  <!--内圆-->
        <div id="circle5" class="circle lazy "></div> <!--内圆-->
    </div>   
</div>

<h2>旋转,渐变色效果的圆形图案</h2>
<div id="advanced" class="circle lazy "></div>

 

 

 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值