您可以通过设置border-*-*-radius
的长度和百分比来实现相似的效果。
div {
width: 100%;
height: 200px;
background-color: red;
border-top-left-radius: 50% 20px;
border-top-right-radius: 50% 20px;
}
border-radius: 10px 10px 0px 9px;
是你要找的。你只需要将以下 CSS 粘贴到你的代码中,下面是一个示例或者访问 https://codepen.io/Chandrakant1594/pen/yEpxOp。
<style>
.curved-border {
height: 200px;
width: 400px;
background: #000000;
border: 3px solid;
box-shadow: inset 0px -1px 0px black; /* just to make the bottom border look thicker */
margin-bottom: 4px;
}
.sample1 {
border-radius: 1500% 1500% 280% 280%/280% 280% 40% 40%;
}
.sample2 {
border-radius: 0% 0% 100% 100%/0% 0% 30% 30%;
}
</style>
<div class='curved-border sample1'></div>
<div class='curved-border sample2'></div>
将元素的边框半径与其大小组合,并为moz和其他浏览器添加特定标签。
示例在此处
HTML
<div class="banner">
</div>
CSS 类
.banner{
background-color:black;
width:100%;
border-radius:40px 40px 0px 0;
height:40px;
}