【css】好看的标签栏

时间:2024-05-10 16:58:58

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      @property --rotate {
        syntax: "<angle>";
        initial-value: 132deg;
        inherits: false;
      }

      body {
        min-height: 100vh;
        background: #212534;
        display: flex;
        align-items: center;
        flex-direction: column;
        padding-top: 2rem;
        padding-bottom: 2rem;
        box-sizing: border-box;
      }
      .dialog {
        background: #191c29;
        width: 200px;
        height: 100px;
        padding: 3px;
        position: relative;
        border-radius: 6px;
        justify-content: center;
        align-items: center;
        text-align: center;
        display: flex;
        /* font-size: 1.5em; */
        color: #fff;
        cursor: pointer;
        /* font-family: cursive; */
      }

      .dialog:hover {
        color: rgb(88 199 250 / 100%);
        transition: color 1s;
      }
      .dialog:hover:before,
      .dialog:hover:after {
        animation: none;
        opacity: 0;
      }

      .dialog::before {
        content: "";
        width: 104%;
        height: 102%;
        border-radius: 8px;
        background-image: linear-gradient(var(--rotate), #5ddcff, #3c67e3 43%, #4e00c2);
        position: absolute;
        z-index: -1;
        top: -1%;
        left: -2%;
        animation: spin 2.5s linear infinite;
      }

      .dialog::after {
        position: absolute;
        content: "";
        top: calc(100px / 6);
        left: 0;
        right: 0;
        z-index: -1;
        height: 100%;
        width: 100%;
        margin: 0 auto;
        transform: scale(0.8);
        filter: blur(calc(100px / 6));
        background-image: linear-gradient(var(--rotate), #5ddcff, #3c67e3 43%, #4e00c2);
        opacity: 1;
        transition: opacity 0.5s;
        animation: spin 2.5s linear infinite;
      }

      @keyframes spin {
        0% {
          background: linear-gradient(0deg, #5ddcff, #3c67e3 43%, #4e00c2);
        }
        100% {
          background: linear-gradient(var(--rotate), #5ddcff, #3c67e3 43%, #4e00c2);
        }
      }
    </style>
  </head>
  <body>
    <div class="dialog">标题-ranAdmin</div>
  </body>
</html>

List item

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题栏</title>
  </head>

  <style>
    .titleContent {
      > div {
        margin: 15px;
      }
    }
    .title {
      height: 32px;
      font-weight: 600;
      line-height: 32px;
      margin-left: 5px;
      padding-left: 5px;
      position: relative;
      color: #000;
      z-index: 0;
    }

    .title1 {
      padding-left: 15px;

      &:after {
        content: " ";
        width: 4px;
        height: 20px;
        background: #12a3f5;
        position: absolute;
        left: 0;
        top: 6px;
        border-radius: 2px;
      }
    }
  </style>
  <body>
    <div class="titleContent">
      <div class="title title1" data-text="'标题">标题-ranAdmin</div>
    </div>
  </body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题栏</title>
  </head>

  <style>
    .titleContent {
      > div {
        margin: 15px;
      }
    }
    .title {
      height: 32px;
      font-weight: 600;
      line-height: 32px;
      margin-left: 5px;
      padding-left: 5px;
      position: relative;
      color: #000;
      z-index: 0;
    }

    .title2 {
      padding-left: 15px;

      &:after {
        content: " ";
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #12a3f5;
        position: absolute;
        left: 0;
        top: 12px;
      }
    }
  </style>
  <body>
    <div class="titleContent">
      <div class="title title2" data-text="'标题">标题-ranAdmin</div>
    </div>
  </body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #main {
        margin: 100px auto;
        width: 500px;
      }
      .dialog {
        position: relative;
        width: 120px;
        height: 40px;
        text-align: center;
        line-height: 40px;
        background: rgb(38, 215, 160);
        border: 2px solid #000;
        border-radius: 3px;
      }
      .dialog::before {
        content: "";
        display: block;
        position: absolute;
        top: 2px;
        left: 2px;
        width: 120px;
        height: 40px;
        background-color: #ccc;
        border: 2px solid #000;
        border-radius: 3px;
        z-index: -1;
      }
      .dialog::after {
        content: "…………………………………";
        display: block;
        position: absolute;
        top: -5px;
        left: -10px;
        z-index: -2;
      }
    </style>
  </head>
  <body>
    <div id="main">
      <div class="dialog">标题-ranAdmin</div>
    </div>
  </body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题栏</title>
  </head>

  <style>
    .titleContent {
      > div {
        margin: 15px;
      }
    }
    .title {
      height: 32px;
      font-weight: 600;
      line-height: 32px;
      margin-left: 5px;
      padding-left: 5px;
      position: relative;
      color: #000;
      z-index: 0;
    }

    .title3 {
      color: #10faf8;
      padding-left: 80px;
      line-height: 22px;
      position: relative;
      border-bottom: 2px solid linear-gradient(to right, #01dfe3, rgba(255, 255, 255, 0));

      &:after {
        content: "";
        position: absolute;
        bottom: 0;
        top: 0;
        left: 18px;
        width: 50px;
        height: 18px;
        transform: skewX(35deg);
        background: linear-gradient(to right, #2d83fa, #10faf8);
      }

      &:before {
        content: "|||";
        display: inline-block;
        font-weight: 900;
        color: #fff;
        line-height: 30px;
        font-size: 18px;
        position: absolute;
        position: absolute;
        top: -8px;
        left: 0;
        color: #2d83fa;
        transform: skewX(35deg);
      }
    }
  </style>
  <body>
    <div class="titleContent">
      <div class="title title3" data-text="'标题">标题-ranAdmin</div>
    </div>
  </body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题栏</title>
  </head>

  <style>
    .titleContent {
      > div {
        margin: 15px;
      }
    }
    .title {
      height: 32px;
      font-weight: 600;
      line-height: 32px;
      margin-left: 5px;
      padding-left: 5px;
      position: relative;
      color: #000;
      z-index: 0;
    }

    .title3 {
      &:after {
        content: "";
        position: absolute;
        bottom: 0;
        top: 0;
        left: 0;
        width: 180px;
        height: 100%;
        opacity: 0.3;
        background: linear-gradient(to right, #4bf15a, #4bf15900);
      }

      &:before {
        content: " ";
        position: absolute;
        bottom: 0;
        left: 0;
        position: absolute;
        height: 2px;
        width: 100%;
        background: linear-gradient(to right, #4bf15a, rgba(255, 255, 255, 0));
      }
    }
  </style>
  <body>
    <div class="titleContent">
      <div class="title title3" data-text="'标题">标题-ranAdmin</div>
    </div>
  </body>
</html>

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题栏</title>
  </head>

  <style>
    .titleContent {
      > div {
        margin: 15px;
      }
    }
    .title {
      height: 32px;
      font-weight: 600;
      line-height: 32px;
      margin-left: 5px;
      padding-left: 5px;
      position: relative;
      color: #000;
      z-index: 0;
    }

    .title8 {
      border-radius: 16px;
      border: 1px solid #e8e9fb;
      box-shadow: 0 0 10px #e8e9fb;
      text-align: center;
      width: 160px;
      color: #12a3f5;

      &:before {
        content: "";
        width: 300%;
        height: 2px;
        background: #e8e9fb;
        position: absolute;
        top: 15px;
        left: 100%;
        background: linear-gradient(to right, #e8e9fb, rgba(255, 255, 255, 0));
      }
    }
  </