CSS - 圆角背景

4

在 CSS 中是否有这个可能?

enter image description here

如果可以,怎么做呢?我尝试了使用 border-top-left-radius,但效果不一样。

5个回答

7

1
我认为 border-radius: 10px 10px 0px 9px; 是你要找的。

1

1
完美简单的解决方案 - undefined

0

你只需要将以下 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>

0

将元素的边框半径与其大小组合,并为moz和其他浏览器添加特定标签。

示例在此处

HTML

 <div class="banner">

    </div>

CSS 类

 .banner{
      background-color:black;
      width:100%;
      border-radius:40px 40px 0px 0;
      height:40px;
    }

https://jsfiddle.net/w7o2rbcu/5/


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接