CSS/进度条:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 引言 == == 圆环 == === conic-gradient === {{codepen|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5"> <div className={cls(styles.section_content, 'cl…”
 
Kangkk​(留言 | 贡献)
 
(未显示同一用户的4个中间版本)
第2行: 第2行:
== 圆环 ==
== 圆环 ==
=== conic-gradient ===
=== conic-gradient ===
{{codepen|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5">
==== 支持 ====
* https://caniuse.com/?search=conic-gradient
 
垫片
 
* https://projects.verou.me/conic-gradient/conic-gradient.js
==== 示例 ====
{{codetab|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5">
<div className={cls(styles.section_content, 'clearfix')}>
<div className={cls(styles.section_content, 'clearfix')}>
   <div className={cls(styles.section_content_icon_box, 'section_content_icon_box_style')}>
   <div className={cls(styles.section_content_icon_box, 'section_content_icon_box_style')}>
第68行: 第75行:
   }
   }
}
}
</syntaxhighlight></tab></tabs>|}}
[[文件:圆环进度条.gif|400px|无框|无|圆环进度条]]
=== 示例一 ===
{{codetab|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5">
<div className={styles.bar_circle}>
  <div className={styles.circle}></div>
</div></syntaxhighlight></tab><tab name="css"><syntaxhighlight lang="css">.bar_circle{
    position: relative;
    height: 200px;
    width: 200px;
    border-radius: 100%;
    background: linear-gradient(#697ad9,#b483de);
    .circle {
        position: relative;
        height: 200px;
        width: 200px;
        background: #fff;
        border: 12px solid transparent;
        border-radius: 50%;
        background-clip: padding-box;
    }
}
</syntaxhighlight></tab></tabs>}}
[[文件:圆形进度条 2.png|500px|无框|无|圆形进度条 2]]
=== 示例二 ===
{{codetab|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5">
<div className={styles.bar}>
    <div className={cls(styles.left, styles.wrapper)}>
        <div className={cls(styles.circle, styles.leftcircle)}></div>
    </div>
    <div className={cls(styles.right, styles.wrapper)}>
        <div className={cls(styles.circle, styles.rightcircle)}></div>
    </div>
</div></syntaxhighlight></tab><tab name="css"><syntaxhighlight lang="css">.progress_container{
    position: fixed;
    width: 100%;
    z-index: 10000;
}
.bar{
    position: relative;
width: 199px;
height : 200px;
    .wrapper{
        width: 100px;
        height: 200px;
        position: absolute;
        top:0;
        overflow: hidden;
    }
    .right{
        right:0;
    }
    .left{
        left:0;
    }
    .circle{
        width: 160px;
        height: 160px;
        border:20px solid transparent;
        border-radius: 50%;
        position: absolute;
        top:0;
        transform : rotate(-135deg);
        box-sizing: content-box;
    }
    .rightcircle{
        border-top:20px solid green;
        border-right:20px solid green;
        right:0;
        animation: circle_right 5s linear infinite;
    }
    .leftcircle{
        border-bottom:20px solid green;
        border-left:20px solid green;
        left:0;
        animation: circle_left 5s linear infinite;
    }
}
@keyframes circle_right{
0%{
transform: rotate(-135deg);
}
50%,100%{
transform: rotate(45deg);
}
}
@keyframes circle_left{
0%,50%{
transform: rotate(-135deg);
}
100%{
transform: rotate(45deg);
}
}
</syntaxhighlight></tab></tabs>}}
</syntaxhighlight></tab></tabs>}}