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>
相关推荐
LFly_ice14 分钟前
学习React-10-useTransition
前端·学习·react.js
咔咔一顿操作16 分钟前
【CSS 3D 交互】实现精美翻牌效果:从原理到实战
前端·css·3d·交互·css3
知识分享小能手20 分钟前
React学习教程,从入门到精通,React 构造函数(Constructor)完整语法知识点与案例详解(16)
前端·javascript·学习·react.js·架构·前端框架·vue
召摇25 分钟前
Nue.js深度解析:极简主义前端框架的革新实践
前端·node.js
小徐_233328 分钟前
uni-app 也能使用 App.vue?wot-starter 是这样实现的!
前端·uni-app
入秋29 分钟前
Three.js后期处理实战:镜头颜色、色差、点阵与颜色管道的深度解析
前端·three.js
深圳外环高速30 分钟前
企业微信和页面离开事件
前端
召摇32 分钟前
NodeBB 深度解析:现代论坛系统的架构设计与实践指南
前端·javascript
哆啦A梦15881 小时前
uniapp分包实现
前端·vue.js·uni-app·vue3
wordbaby1 小时前
Hooks的革命:让React的非UI逻辑也能像UI组件一样自由复用和组合
前端·react.js