gpt4 book ai didi

CSS:加载微调器方形圆形外观

转载 作者:太空宇宙 更新时间:2023-11-04 13:04:23 25 4
gpt4 key购买 nike

我正在尝试仅使用 CSS 实现微调器,如下图所示,请参见图片。一次只有一件旋转器充满颜色。 Spinner

在下面的 fiddle 中,有一个类似的微调器,但我需要旋转整个微调器 (22.5°) 并修改它的光线。

http://jsfiddle.net/ucsnaukf/

HTML:

<div class="spinner"><div>Loading…</div></div>

CSS:

@-webkit-keyframes spin {
to { transform: rotate(1turn); }
}
@-moz-keyframes spin {
to { transform: rotate(1turn); }
}
@-ms-keyframes spin {
to { transform: rotate(1turn); }
}
@keyframes spin {
to { transform: rotate(1turn); }
}

.spinner {
position: relative;
display: inline-block;
width: 5em;
height: 5em;
margin: 0 .5em;
font-size: 12px;
text-indent: 999em;
overflow: hidden;
-webkit-animation: spin 0.8s infinite steps(8);
-moz-animation: spin 0.8s infinite steps(8);
-ms-animation: spin 0.8s infinite steps(8);
-o-animation: spin 0.8s infinite steps(8);
animation: spin 0.8s infinite steps(8);
}

.spinner:before,
.spinner:after,
.spinner > div:before,
.spinner > div:after {
content: '';
position: absolute;
top: 0;
left: 2.25em; /* (container width - part width)/2 */
width: .5em;
height: 1.5em;
border-radius: .2em;
background: #eee;
box-shadow: 0 3.5em #eee; /* container height - part height */
transform-origin: 50% 2.5em; /* container height / 2 */
}

.spinner:before {
background: blue;
}

.spinner:after {
transform: rotate(-45deg);
}

.spinner > div:before {
transform: rotate(-90deg);
}

.spinner > div:after {
transform: rotate(-135deg);
}

有人能帮忙吗?

最佳答案

这是您的开始 ( http://jsfiddle.net/ucsnaukf/73/ ):

<--! HTML -->
<div class="wrapper">
<div class="spinner">
<div>Loading…
</div>
</div>
<div class="circ"></div>
</div>

/* CSS */
@-webkit-keyframes spin {
to { transform: rotate(1turn); }
}
@-moz-keyframes spin {
to { transform: rotate(1turn); }
}
@-ms-keyframes spin {
to { transform: rotate(1turn); }
}
@keyframes spin {
to { transform: rotate(1turn); }
}
.wrapper{
border:1px solid white;
border-radius:100%;

position:relative;
width: 5em;
height: 5em;
border-radius:999px;
overflow:hidden;
}
/* Circular mask */
.circ{
border:1px solid WHITE;
position:absolute;
top:10%;
left:10%;
right:0;
bottom:0;
width:55%;
height:55%;
background-color:#fff;
border-radius:999px;
}
.spinner {
border:1px solid white;
border-radius:100%;/* Round the border */
position: absolute;
display: inline-block;
width: 5em;
height: 5em;
font-size: 12px;
text-indent: 999em;
overflow: hidden;
-webkit-animation: spin 0.8s infinite steps(8);
-moz-animation: spin 0.8s infinite steps(8);
-ms-animation: spin 0.8s infinite steps(8);
-o-animation: spin 0.8s infinite steps(8);
animation: spin 0.8s infinite steps(8);
}

.spinner:before,
.spinner:after,
.spinner > div:before,
.spinner > div:after {
content: '';
position: absolute;
top: 0;
left: 1.8em; /* (container width - part width)/2 */
width: 1.4em; /* longer */
height: .8em; /* shorter */
background: #eee;
box-shadow: 0 4.2em #eee; /* container height - part height */
transform-origin: 50% 2.5em; /* container height / 2 */
}

.spinner:before {
background: purple;
}

.spinner:after {
transform: rotate(-45deg);
}

.spinner > div:before {
transform: rotate(-90deg);
}

.spinner > div:after {
transform: rotate(-135deg);
}

看起来有点像花,但继续玩它,你会得到你想要的样子。

您可能想考虑使用 Web 上众多外观漂亮、可免费使用的微调器之一...查看这个庞大的集合,例如:http://codepen.io/collection/HtAne/

关于CSS:加载微调器方形圆形外观,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25242169/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com