CSS/HTML复杂形状

sup*_*r.t -1 html css css-shapes

创建以下形状的最佳方法是什么?在此输入图像描述

Nen*_*car 7

您可以使用一个元素:before:after伪元素来完成此操作.

.el {
  position: relative;
  display: inline-block;
  text-align: center;
  line-height: 100px;
  background: #89C3EE;
  margin: 50px 150px;
  width: 100px;
  height: 100px;
  border: 3px solid #6295DC;
  border-radius: 50%;
}
.el:before,
.el:after {
  content: 'Text';
  position: absolute;
  height: 50px;
  line-height: 50px;
  width: 100px;
  top: 50%;
  transform: translateY(-50%);
  background: #89C3EE;
  border-top: 3px solid #6295DC;
  border-bottom: 3px solid #6295DC;
}
.el:before {
  width: 150px;
  left: -143px;
}
.el:after {
  right: -94px;
}
Run Code Online (Sandbox Code Playgroud)
<div class="el">Text</div>
Run Code Online (Sandbox Code Playgroud)