以下是我的代码,其中我无法创建底部曲线,但增加 border-top-left-radius/border-top-right-radius 无法创建如图所示的凹凸。让我知道如何仅使用 CSS 处理此问题。
代码:
.container {
position: relative;
}
.rect {
width: 334.5px;
height: 223px;
background: #34EFEE;
text-align: center;
line-height: 223px;
}
.rect:after {
content: '';
position: absolute;
bottom: 0px;
width: 334.5px;
height: 15px;
background: #FFFFFF;
left: 0;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
}Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="rect">
<h3>334.5 X 223</h3>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
预期输出 -
PLNKR —— http: //plnkr.co/edit/7oTCHyn8PFABri0KHSrH?p=preview
您可以使用:after伪元素来创建形状并box-shadow为蓝色背景添加大尺寸。
div {
width: 300px;
height: 150px;
position: relative;
overflow: hidden;
text-align: center;
color: white;
}
div:after {
content: '';
box-sizing: border-box;
position: absolute;
bottom: 0;
left: 50%;
height: 100px;
width: 120%;
border: 5px solid black;
transform: translate(-50%, 50%);
box-shadow: 0px 0px 0px 200px #00A2E8;
border-radius: 50%;
z-index: -1;
}Run Code Online (Sandbox Code Playgroud)
<div>Lorem ipsum</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1774 次 |
| 最近记录: |