gpt4 book ai didi

css - 使用 css 动画的线微调器

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

有没有什么方法可以在不使用 javascript 的情况下使用纯 css 动画添加线微调器(来自 spin.js - https://spin.js.org)(示例:https://www.w3schools.com/howto/howto_css_loader.asp)?

最佳答案

是的,你可以,感谢这篇文章:click to see

为了最简单的理解,这里是代码片段:

/**
* (C)Leanest CSS spinner ever
*/

@keyframes spin {
to { transform: rotate(1turn); }
}

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

.small.progress {
font-size: 6px;
}

.large.progress {
font-size: 24px;
}

.progress:before,
.progress:after,
.progress > div:before,
.progress > 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 */
}

.progress:before {
background: #555;
}

.progress:after {
transform: rotate(-45deg);
background: #777;
}

.progress > div:before {
transform: rotate(-90deg);
background: #999;
}

.progress > div:after {
transform: rotate(-135deg);
background: #bbb;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">

</head>
<body>

<h2>How To Create A Loader</h2>


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


</body>
</html>

jsFiddle

关于css - 使用 css 动画的线微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49794070/

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