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>
相关推荐
ReturnTrue86818 小时前
nginx性能优化之Gzip
前端
w_y_fan19 小时前
Flutter 滚动组件总结
前端·flutter
wuli金居哇19 小时前
我用 Turborepo 搭了个 Monorepo 脚手架,开发体验直接起飞!
前端
Asort19 小时前
JavaScript 从零开始(五):运算符和表达式——从零开始掌握算术、比较与逻辑运算
前端·javascript
一枚前端小能手19 小时前
🚀 缓存用错了网站更慢?前端缓存策略的5个致命误区
前端·javascript
艾小码19 小时前
为什么你的页面会闪烁?useLayoutEffect和useEffect的区别藏在这里!
前端·javascript·react.js
艾小码19 小时前
告别Vue混入的坑!Composition API让我效率翻倍的3个秘密
前端·javascript·vue.js
南雨北斗19 小时前
VS Code 中手动和直接运行TS代码
前端
小高00719 小时前
🔍说说对React的理解?有哪些特性?
前端·javascript·react.js
Samsong19 小时前
JavaScript逆向之反制无限debugger陷阱
前端·javascript