当前位置: 首页 > article >正文

CSS实现图片缺角效果

效果:

源码: 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>123</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #f9f9f9;
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100vh;
        }

        .row {
            display: flex;
            padding: 30px;
            gap: 30px;
            flex-wrap: wrap;
            background: inherit;
        }

        .box {
            position: relative;
            width: 500px;
            height: 250px;
            border-radius: 20px;
            background-color: inherit;
        }

        .btn {
            display: inline-flex;
            padding: 12px 20px;
            justify-content: center;
            align-items: center;
            color: white;
            text-decoration: none;
            background-color: #000521;
            border-radius: 80px;
        }

        .btn-decor-wrap {
            position: absolute;
            left: 0;
            bottom: 0;
            display: inline-block;
            padding: 24px 24px 0 0;
            margin: 24px 24px 0 0;
            border-top-right-radius: 45px;
            background-color: inherit;
        }

        .btn-decor-wrap:after,
        .btn-decor-wrap:before {
            z-index: 0;
            position: absolute;
            display: block;
            width: 24px;
            height: 24px;
            content: '';
            clip-path: polygon(0.082%0%, 0%0%, 0%100%, 100%100%, 100%99.918%, 100%99.918%, 84.085%98.066%, 68.994%93.913%, 54.912%87.642%, 42.022%79.44%, 30.51%69.49%, 20.56%57.978%, 12.358%45.088%, 6.088%31.006%, 1.934%15.915%, 0.082%0%);
            background-color: inherit;
            overflow: hidden;
        }

        .btn-decor-wrap:before {
            top: -24px;
            left: 0;
        }

        .btn-decor-wrap:after {
            right: -24px;
            bottom: 0;
        }
    </style>
</head>

<body>
    <div class="row">
        <div class="box" style="background-image: url('https://img-home.csdnimg.cn/images/20250224104257.png');background-size: cover;background-position: center;">
            <span class="btn-decor-wrap">
                <a href="#" class="btn">了解更多</a>
            </span>
        </div>
    </div>
</body>

</html>


http://www.kler.cn/a/560834.html

相关文章:

  • 如何查找 UBuntu的 arm版本
  • 大数据AI一体化开发再加速:DataWorks 支持GPU类型资源
  • 基于Springboot医院预约挂号小程序系统【附源码】
  • 2025:人工智能重构人类文明的新纪元
  • 插入排序:一种简单而直观的排序算法
  • 15.2 智能销售顾问系统技术架构解密:构建企业级知识驱动型对话引擎
  • 应对LLM应用中的AI幻觉,如何通过Token对数概率预测LLM的可靠性
  • 【无标题】docker-compose ps 和dokcer ps的区别
  • 23. AI-大语言模型-DeepSeek简介
  • 毕业项目推荐:基于yolov8/yolov5/yolo11的非机动车头盔佩戴检测识别系统(python+卷积神经网络)
  • 网络应用层之HTTP
  • Android Audio实战——音频相关基础概念(附)
  • CentOS的ssh复制文件
  • 强化学习笔记(一)
  • 游戏引擎学习第120天
  • 鸿蒙-canvas-刮刮乐
  • 122页PPT!企业数字化IT架构蓝图规划设计方案:总体框架、IT治理全景图、IT治理管控框架、蓝图架构、演进路线、实施治理
  • 计算机网络与通讯知识总结
  • springcloud跟dubbo有什么区别
  • 设计模式教程:备忘录模式(Memento Pattern)