javascript - CSS/jQuery - 是否可以创建此形状(类似于倒圆)

标签 javascript jquery css css-shapes

我不知道如何在 Angular 落制作倒圆圈之类的东西。为了更好地理解,我附上了图片。

enter image description here

这甚至可以使用 CSS3 或 jQuery 创建吗?

最佳答案

我建议如何创建该形状 SVG

CSS解决方案:
使用与背景匹配的前后元素。

.shape {
  position: relative;
  width: 400px;
  height: 120px;
  background-color: cornflowerblue;
  text-align: center;
  color: white;
  line-height: 120px;
}
/*replace with "" if your going to use the code*/

.shape:before {
  content: "↙";
  font-size: 2.5em;
  text-indent: 35%;
  line-height: 0%;
  position: absolute;
  top: calc(100% - 20px);
  left: 0;
  width: 35%;
  height: 50%;
  background-color: white;
  border-top-right-radius: 15px;
}
.shape:after {
  content: "↘";
  line-height: 0%;
  text-indent: -43%;
  font-size: 2.5em;
  position: absolute;
  top: calc(100% - 20px);
  right: 0;
  width: 35%;
  height: 50%;
  background-color: white;
  border-top-left-radius: 15px;
}
.shape .extra {
  position: absolute;
  top: 100%;
  background-color: cornflowerblue;
  width: 30%;
  height: 30%;
  left: 35%;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
}
<div class="shape">This is not a problem any more
  <div class="extra"></div>
</div>

SVG: 使用路径元素,然后使用贝塞尔曲线命令。
MDN paths

<svg width="300px" viewbox="0 0 100 60">
  <path fill="cornflowerBlue" d="m 0,0 
                                 100,0 
                                 0,30
                                 -25,0
                                 c-5,0 -5,0 -5,5
                                 v20
                                 c0,5 0,5 -5,5
                                 h-30
                                 c-5,0 -5,0 -5,-5
                                 v-20
                                 c 0,-5 0,-5 -5,-5
                                 h-25z" />
</svg>

关于javascript - CSS/jQuery - 是否可以创建此形状(类似于倒圆),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32462672/

相关文章:

javascript - 如何对使用 ng-bind-html 渲染的可编辑 DIV 中的文本进行 ng 建模?

javascript - NodeJS,在 TLS 服务器上获取客户端 IP

asp.net - Firefox 上的 CompareValidator 问题

javascript - 从数组中的对象连接数组

jQuery Ajax - 获取元素内部文本

javascript - 是否可以通过搜索字段使用 `switch_user`?

javascript - 悬停效果子类别显示并向右侧滑动

javascript - 如何将溢出的 div 右对齐?

javascript - 根据循环变量的值给特定的 HTML 表格 block 着色的问题

css - 里面有单选按钮的样式标签