css三角的巧妙运用

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

        .box1 {

            width: 0;

            height: 0;

            /* 把上边框调大 */

            /* border-top: 100px solid transparent;

            border-right: 50px solid skyblue; */

            /* 左边和下边的边框宽度设置为0 */

            /* border-bottom: 0px solid blue;

            border-left: 0px solid green; */

            /* 只保留右边边框有颜色 */

            border-color: transparent red transparent transparent;

            /* 样式都是solid */

            border-style: solid;

            /* 上边框要大,右边框 宽度小一点 其余边框为0 */

            border-width: 100px 50px 0 0;

        }

        .price {

            width: 160px;

            height: 24px;

            border: 1px solid red;

            margin: auto;

            line-height: 24px;

        }

        .miaosha {

            position: relative;

            float: left;

            width: 90px;

            height: 100%;

            background-color: red;

            text-align: center;

            color: #fff;

            font-weight: 700;

        }

        .miaosha i {

            position: absolute;

            right: 0;

            top: 0;

            width: 0;

            height: 0;

            border-color: transparent #fff transparent transparent;

            border-style: solid;

            border-width: 24px 10px 0 0;

        }

        .origin {

            font-size: 12px;

            color: grey;

            text-decoration: line-through;

        }

    </style>

</head>

<body>

    <div class="box1"></div>

    <div class="price">

        <span class="miaosha">$1650

            <i></i>

        </span>

        <span class="origin">$5650</span>

    </div>

</body>

</html>

相关推荐

  1. css巧妙运用

    2024-04-23 06:26:04       31 阅读
  2. 深入理解Spring框架:设计模式巧妙运用

    2024-04-23 06:26:04       16 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-23 06:26:04       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-23 06:26:04       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-23 06:26:04       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-23 06:26:04       18 阅读

热门阅读

  1. HCIP-Datacom-ARST必选题库_22_SDWAN【1道题】

    2024-04-23 06:26:04       14 阅读
  2. 《前端面试题》- TypeScript - TypeScript的优/缺点

    2024-04-23 06:26:04       14 阅读
  3. Android Studio 快捷键及使用技巧汇总

    2024-04-23 06:26:04       13 阅读
  4. k8s whereabouts 使用

    2024-04-23 06:26:04       13 阅读
  5. Github 2024-04-22 开源项目日报Top10

    2024-04-23 06:26:04       15 阅读