Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

制作 CSS 透明气泡框 #269

Open
yanyue404 opened this issue Jan 10, 2024 · 0 comments
Open

制作 CSS 透明气泡框 #269

yanyue404 opened this issue Jan 10, 2024 · 0 comments
Labels

Comments

@yanyue404
Copy link
Owner

yanyue404 commented Jan 10, 2024

    <button  class="bubble-tag">
        <span> 透明气泡框(带上箭头)</span>
    </button>
  .bubble-tag {
    position: relative;
    display: flex;
    justify-content: center;
    height: 40px;
    line-height: 40px;
    background: #ffffff;
    border: 1px solid #aaaaaa;
    text-align: center;
    font-size: 24px;
    color: #999;
    border-radius: 18px;
    margin: 0px auto 15px;
    padding: 0 20px;
    span {
      display: inline-block;
      height: 98%;
      background: #fff;
      z-index: 1;
    }
    // 有色的等腰三角形
    &:before {
      content: '';
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 0 22px 20px 22px;
      border-color: transparent transparent #ccc transparent;
      position: absolute;
      top: -18px;
      right: 50%;
      transform: translateX(50%);
    }
    // 白色的等腰三角形(比上面的稍小一点点)

    &::after {
      content: '';
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 0 20px 18px 20px;
      border-color: transparent transparent #ffffff transparent;
      position: absolute;
      top: -17px;
      right: 50%;
      transform: translateX(50%);
    }
  }

参考

@yanyue404 yanyue404 added the Css label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant