css不用伪类实现底部弧度效果的两种办法border-radius的八个值

有天需求需要写一个底部有弧度的盒子,长这样

在这里插入图片描述
网上都大多需要伪类元素:after
我在想怎么不用伪类就可以写出来
第一个笨方法

   <style> 
    .box{width: 800px;height: 400px;margin: 0 auto;position: relative;margin-top: 200px;overflow: hidden;}
    .box1{ width: 5000px;height:5000px;overflow: hidden;  border-radius:50%;background: #ffffff;position: absolute;bottom: 0px; left: -2100px;; background:coral; }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1">
            <div style="width: 800px;height: 400px;background-image: url('./img/sssw1.jpg');background-size:100% 100%; ;position: absolute;left: 50%;bottom: 0;transform: translateX(-50%);">

            </div>
        </div>
    </div>

最终效果就是这样
在这里插入图片描述
还有一种就是使用border-radius的八个值

  <!--  x轴 上1234/ y轴 上5678 -->

 <div style="width: 400px;height: 200px;background:red;margin: 0 auto; 
  border-radius: 50% 50% 0 0 / 20% 20% 0 0;">
        八个值
   </div>
    <div style="width: 400px;height: 200px;background:red;margin: 0 auto;
      border-radius: 0 0 50% 50% / 0 0 20% 20%;">
        八个值
    </div>

结果是这样
需要自己调试
在这里插入图片描述
小白一个多多包涵

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值