# 环形文字

背景知识: SVG (opens new window), transition (opens new window)

You-need-to-know-css-tricks-You-need-to-know-css-tricks-You-
<style>
  .main-circular-text {
    width: 289px; height: 289px;
    margin: 80px auto;
    font-size: 12px;
  }
  .main-circular-text svg {
    overflow: visible;
    animation: circular-text-rotate 5s linear paused infinite;
  }
  .main-circular-text svg:hover {
    animation-play-state: running;
  }
  .main-circular-text path {
    fill: none;
  }
  .main-circular-text text {
    fill: #b4a078;
  }
  @keyframes circular-text-rotate {
    to {
      transform: rotate(1turn);
    }
  }
</style>
<template>
  <div class="main-circular-text">
    <svg viewBox="0 0 100 100">
        <path d="M 0,50 a 50,50 0 1,1 0,1 z" id="circle" />
        <text>
          <textPath xlink:href="#circle">
            You-need-to-know-css-tricks-You-need-to-know-css-tricks-You-
          </textPath>
        </text>
    </svg>
  </div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
显示代码 复制代码
上次更新: 2023-10-28