[英]Implementing “Pure CSS Sphere” into website - how do I do it?
http://codepen.io/waynespiegel/pen/jEGGbj
我发现了这个很棒的东西,我想成为我网站的一部分(仅供个人使用和实践),并对如何实现这一点感到好奇。 我对这种编程还很陌生。 我正在使用GitPages并正在运行一个网站。
决定使用以下代码制作一个名为“ sphere.css”的文件:
$size: 300px;
$total: 100;
$time: 5s;
* { box-sizing:border-box; }
html, body {
width: 100%;
height: 100%;
background: #000;
overflow: hidden;
display: box;
box-align: center;
box-pack: center;
.o-wrapper {
width: $size;
height: $size;
transform-style: preserve-3d;
animation: $time spin-that-shit linear infinite;
.o {
position: absolute;
height: 100%;
width: 100%;
border: 1px solid;
border-radius: 100%;
@for $i from 1 through $total {
&:nth-child(#{$i}) {
transform: rotateY($i * 2deg) rotateX($i * 2deg);
border-color: hsla($i * 10%, 100%, 50%, .2);
}
}
}
}
}
@keyframes spin-that-shit {
100% { transform: rotateX(360deg) rotateY(360deg); }
}
还有另一个名为“ sphere.html”的文件,其代码为:
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen">
<body>
<header>
Random Title
</header>
<div id="content-wrapper">
<div class="inner clearfix">
<section id="main-content">
.o-wrapper
-100.times do
.o
</section>
</div>
</div>
</body>
</html>
但这显然行不通,我也不知道在哪里放置这样的代码才能使其正常工作。 再一次,这只是出于学习目的。
提前致谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.