• CSS 实现圆形图上下两种颜色 (字体渐变、背景渐变)


    效果如下

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
    </head>
    <style>
      .main {
         500px;
        margin: auto;
        display: flex;
        justify-content: space-between;
      }
      
      .box {
         200px;
        height: 200px;
        border-radius: 50%;
        border: 2px solid red;
        text-align: center;
        line-height: 200px;
        position: relative;
        overflow: hidden;
      }
      .box1:before {
         200px;
        height: 100px;
        content: '';
        position: absolute;
        background-color: aquamarine;
        left: 0;
        top: 0;
        z-index: 1;
      }
      .box1:after {
         200px;
        height: 100px;
        content: '';
        position: absolute;
        background-color: yellow;
        left: 0;
        bottom: 0;
        z-index: 1;
      }
    
      .box1 .text {
         120px;
        height: 30px;
        line-height: 1;
        position: absolute;
        z-index: 10;
        left: calc(50% - 60px);
        top: calc(50% - 15px)
      }
      .box2 {
        background: linear-gradient(to bottom, aquamarine 0%, aquamarine 50%, yellow 51%, yellow 100%);
      }
      .box .text {
        font-size: 30px;
        background: linear-gradient(to bottom, red 0%, blue 100%);
        -webkit-background-clip: text;
        color: transparent;
      }
      
      
    </style>
    <body>
      <div class="main">
        <div class="container">
          <h2>定位法 position</h2>
          <div class="box box1">
            <span class="text">秃了老哥</span>
          </div>
        </div>
        <div class="container">
          <h2>渐变法 linear-gradient</h2>
          <div class="box box2">
            <span class="text">秃了老哥</span>
          </div>
        </div>
      </div>
      <pre></pre>
    </body>
    </html>
    

      

  • 相关阅读:
    DB2完美卸载
    protobuf2.5 iphone5s中崩溃的问题
    由fprintf和printf看C语言三种标准流
    AIR加载PDF
    使用二叉堆实现优先队列
    11636
    apache archiva安装教程
    WP独立文件资源字典
    常用软件架构模式(收集)
    MATLAB——单层感知器
  • 原文地址:https://www.cnblogs.com/fczbk/p/13818332.html
Copyright © 2020-2023  润新知