第一种:::after
<template>
<view>
<view class="bg">
</view>
</view>
</template>
<style>
.bg{
background-color: pink;
}
.bg::after{
content: '';
position: absolute;
width: 160%;
height: 100px;
background: skyblue;
left: -30%;
border-radius: 0 0 50% 50%;
}
</style>

第二种:border-radius
<template>
<view>
<view class="bg">
</view>
</view>
</template>
<style>
.bg{
background-color: pink;
border-radius:0 0 50% 50%/40%;
height: 100px;
width: 160%;
margin-left: -30%;
}
</style>

border-radius:* * /*
border-radius:50% 50%/50%;
height: 200px;
width: 200px;

border-radius:0 0 50% 50%/50%;
height: 200px;
width: 200px;

border-radius:0 0 50% 50%/10%;
height: 200px;
width: 200px;

border-radius:0 0 50% 50%/90%;
height: 200px;
width: 200px;

本文介绍了两种使用CSS实现独特背景效果的方法。第一种利用`::after`伪元素,设置绝对定位,宽高、背景色及边框半径来创建形状。第二种则是直接通过`border-radius`属性,结合百分比值来塑造不规则的背景形状。这些技巧可以用于网页设计中增加视觉吸引力。
2252

被折叠的 条评论
为什么被折叠?



