Skip to the content.

CSS3 属性



文字镂空效果


<style>
  body {
    background-color: #000;
  }

  a {
    font-size: 60px;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 1px #fff;
  }
</style>
<body>
  <a>Watch now</a>
</body>



文字渐变色


<style>
  a {
    font-size: 60px;
    background: linear-gradient(
      92.05deg,
      #bca1f7 12.09%,
      #e577b4 42.58%,
      #ff7170 84.96%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-box-decoration-break: clone;
  }
</style>
<body>
  <a href="#"> Watch now </a>
</body>



元素片段跨行、跨列渲染表现



<style>
  .box {
    width: 200px;
    color: #fff;
  }
  .text {
    border-radius: 30px;
    background-color: #cd0000;
    /* 区别在这 */
    -webkit-box-decoration-break: clone;
  }
</style>

<div class="box">
  <span class="text">这段文字将被折断.这段文字将被折断</span>
</div>



参见