div+css布局实现文字环绕成太阳形状代码

代码语言:html

所属分类:布局界面

代码描述:div+css布局实现文字环绕成太阳形状代码

代码标签: div css 布局 文字 环绕 太阳 形状 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
@property --rotate {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@property --delayed-rotate {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
@keyframes scrollAnim {
  to {
    --rotate: 1;
    --delayed-rotate: 1;
  }
}
:root {
  --circle-size: 30vmin;
  --spacing: 3vmin;
  --font-size: 5vmin;
  --ease-speed: 50ms;
}

body {
  height: 500vh;
  margin: 0;
  padding: 0;
  font-family: serif;
  font-size: var(--font-size);
  background-color: #EDE8E4;
  color: #222;
  animation: scrollAnim linear;
  animation-timeline: scroll(nearest block);
}

ul {
  position: fixed;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: block;
  width: var(--circle-size);
  height: var(--circle-size);
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: 50%;
  transform: rotate(calc(var(--rotate) * 360deg));
}

li {
  position: absolute;
  top: 50%;
  left: 50%;
  line-height: 0;
  transform-origin: 0 0;
  text-wrap: nowrap;
}
li:nth-child(1) {
  rotate: calc(18deg);
}
li:nth-child(2) {
  rotate: calc(36deg);
}
li:nth-child(3) {
  rotate: calc(54deg);
}
li:nth-child(4) {
  rotate: calc(72deg);
}
li:nth-child(5) {
  rotate: calc(90deg);
}
li:nth-child(6) {
  rotate: calc(108deg);
}
li:nth-child(7) {
  rotate: calc(126deg);
}
li:nth-child(8) {
  rotate: calc(144deg);
}
li:nth-child(9) {
  rotate: calc(162deg);
}
li:nth-child(10) {
  rotate: calc(180deg);
}
li:nth-child(11) {
  rot.........完整代码请登录后点击上方下载按钮下载查看

网友评论0