css实现两边有缺口的卡券效果

自己项目用到优惠券的样式,特拿来分享。主要用到了css的position: absolute属性。
效果如下图:
css实现两边有缺口的卡券效果_第1张图片
废话不多说,直接上代码


<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>验证券样式title>
    <style>
            body{
                background-color: #E2DFDF;
            }
        .div{
            position: relative;
            width: 200px;
            height: 100px;

            margin:100px auto;
            background-color: #fff;
        }
        .yuan1{
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 20px;
            background-color: #E2DFDF;
            left: -10px;
            top:40px;
        }
        .yuan2{
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 20px;
            background-color: #E2DFDF;
            right: -10px;
            top:40px;
        }
    style>
head>
<body>
    <div class="div">
        <div class="yuan1">div>
        <div class="yuan2">div>
    div>
body>
html>

你可能感兴趣的:(web前端)