网站首页 > 知识剖析 正文
<view class="certificateContent">
<view class="certificateName">
</view>
<view class="certificateCode">
<view class="code">
</view>
</view>
</view>
先使用border-radius来实现半圆的形状,在利用伪类元素::before和::after放在标签名code的前后,最后利用定位position来放置在合适的位置。具体实现样式如下:
<style lang="scss" scoped>
.certificateContent {
height: auto;
padding: 0px 16px;
.certificateName {
height:100rpx;
background: red
}
.certificateCode {
height: 100rpx;
background: red
border-top: 0;
padding: 2px 16px 20px 16px;
.code {
position: relative;
}
.code::before {
content: "";
width: 10px;
height: 20px;
position: absolute;
border: 1px solid #ffffff;
border-radius: 0 20px 20px 0;
border-left: none;
position: absolute;
left: -16px;
top: -10px;
background: #f6f7f8;
}
.code::after {
content: "";
width: 10px;
height: 20px;
position: absolute;
border: 1px solid #ffffff;
border-radius: 20px 0px 0px 20px;
border-right: none;
position: absolute;
right: -16px;
top: -10px;
background: #f6f7f8;
}
}
}
</style>
实现效果如图:
- 上一篇: 利用border做成三角形_border制作三角形
- 下一篇: css背景设置_css如何设置背景
猜你喜欢
- 2025-09-13 如何帮图片加边框?方法有三种_如何帮图片加边框?方法有三种颜色
- 2025-09-13 Web开发中最致命的小错误_web开发的难点
- 2025-09-13 5个CSS新功能,简单好用还超省时间
- 2025-09-13 用了这5个 @function,CSS代码量减少三分之二?
- 2025-09-13 CSS中的background-clip详解_css background no repeat
- 2025-09-13 9个小细节帮你优化CSS代码_如何优化css性能
- 2025-09-13 CSS currentColor:让样式开发效率提升3倍的隐藏技巧
- 2025-09-13 css背景设置_css如何设置背景
- 2025-09-13 利用border做成三角形_border制作三角形
- 2025-09-13 CSS基础-边框和圆角_css中边框圆角
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)