CSS implements semicircular grooves on both sides of a rectangle


To achieve this effect, prepare a rectangular box

<view class="content-box"></view>

css样式如下:

.content-box{
    
    
  width: 630rpx;
  height: 480rpx;
  position: relative;
  background-color: #fff;
  margin: 30rpx 60rpx 40rpx;
}
.content-box:after {
    
    
  position: absolute;
  content: "";
  width: 20px;
  height: 20px;
  background: #eef1f9;
  border-radius: 100%;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
}

.content-box:before {
    
    
  position: absolute;
  content: "";
  width: 20px;
  height: 20px;
  background: #eef1f9;
  border-radius: 100%;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
}

Guess you like

Origin blog.csdn.net/weixin_44738158/article/details/123280349