CSS/进度条:修订间差异
来自康健生活
| (未显示同一用户的1个中间版本) | |||
| 第2行: | 第2行: | ||
== 圆环 == | == 圆环 == | ||
=== conic-gradient === | === conic-gradient === | ||
==== 支持 ==== | |||
* https://caniuse.com/?search=conic-gradient | |||
垫片 | |||
* https://projects.verou.me/conic-gradient/conic-gradient.js | |||
==== 示例 ==== | |||
{{codetab|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5"> | {{codetab|tabs=<tabs><tab name="html"><syntaxhighlight lang="html5"> | ||
<div className={cls(styles.section_content, 'clearfix')}> | <div className={cls(styles.section_content, 'clearfix')}> | ||
| 第70行: | 第77行: | ||
</syntaxhighlight></tab></tabs>|}} | </syntaxhighlight></tab></tabs>|}} | ||
[[文件:圆环进度条.gif|400px|无框|无|圆环进度条]] | [[文件:圆环进度条.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>}} | |||