css实现antd丝带效果

先上效果图:

代码:

html 复制代码
<!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>
    .ant-ribbon {
        box-sizing: border-box;
        margin: 0;
        padding: 0 8px;
        color: #1677ff;
        font-size: 14px;
        line-height: 22px;
        list-style: none;
        position: absolute;
        top: 8px;
        white-space: nowrap;
        background-color: #1677ff;
        border-radius: 4px;
        border-end-end-radius: 0;
    }

    .ant-ribbon-text {
        color: #ffffff;
    }

    .ant-ribbon-placement-end {
        inset-inline-end: 8px;
        border-end-end-radius: 0;
    }

    .ant-ribbon-corner {
        position: absolute;
        top: 100%;
        width: 8px;
        height: 8px;
        color: currentcolor;
        border: 4px solid;
        transform: scaleY(0.75);
        transform-origin: top;
        filter: brightness(75%);
        box-sizing: border-box;
        inset-inline-end: 0;
        border-inline-end-color: transparent;
        border-block-end-color: transparent;
    }

</style>

<body>
    <div class="ant-ribbon ant-ribbon-placement-end">
        <span class="ant-ribbon-text">5.17.0</span>
        <div class="ant-ribbon-corner">
        </div>
    </div>
</body>

</html>
相关推荐
Data_Adventure28 分钟前
Vite 项目中使用 vite-plugin-dts 插件的详细指南
前端·vue.js
八戒社31 分钟前
如何使用插件和子主题添加WordPress自定义CSS(附:常见错误)
前端·css·tensorflow·wordpress
xzboss43 分钟前
DOM转矢量PDF
前端·javascript
一无所有不好吗43 分钟前
纯前端vue项目实现版本更新(纯代码教程)
前端
安全系统学习1 小时前
内网横向之RDP缓存利用
前端·安全·web安全·网络安全·中间件
Hilaku1 小时前
为什么我不再相信 Tailwind?三个月重构项目教会我的事
前端·css·前端框架
FogLetter1 小时前
JavaScript 的历史:从网页点缀到改变世界的编程语言
前端·javascript·http
鹏北海1 小时前
Vue3+TS的H5项目实现微信分享卡片样式
前端·微信
轻颂呀1 小时前
进程——环境变量及程序地址空间
前端·chrome
lyc2333331 小时前
鸿蒙Stage模型:轻量高效的应用架构「舞台革命」🎭
前端