底部边框淡​​出的圆圈

The*_*Mah 2 html css svg css-shapes

我正在尝试使用 css (或 svg)绘制此输出。对我来说,最困难的部分是圆的左右两侧的半弧。我应该坚持纯CSS还是使用图像更好?

任何帮助表示赞赏...

底部带有淡出边框的图形

这就是我设法做到的:

我的设计

这是代码:

body {
  background-color: #002911 !important;
}

h3 {
  color: #ffd004;
}

#actions-container {
  margin-top: 30px;
}

#actions-container .action-icon {
  width: 200px;
  height: 200px;
  background-color: rgb(255, 208, 4);
  border-radius: 50%;
  box-shadow: 5px -2px 6px 3px #0000004a;
  /* center contents*/
  display: flex;
  justify-content: center;
  align-items: center;
}

.right-arc {
  position: relative;
  display: inline-block;
  font-size: 30px;
  color: lightgreen;
  margin: 40px;
}

.right-arc::after {
  content: '';
  position: absolute;
  right: -150px;
  top: 57px;
  height: 300px;
  width: 300px;
  border-radius: 50% 50% 50% 50%;
  border-width: 0px 1px 0px 0px;
  border-style: solid;
  /*border-top: outset;*/
}


/*svg {
            width: 33%;
            height: auto;
        }*/
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" />
<div class="container" id="actions-container">
  <div class="d-flex justify-content-between">

    <div class="action-icon-box text-center ">
      <div class="right-arc">

      </div>


      <h3 class="text-center">Title</h3>

      <div class="p-1 action-icon text-center mt-4">
        <a href="#"><img class="center" src="/Content/images/lp-homepage/microphone.png" height="100" /></a>
      </div>
    </div>

  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

web*_*iki 5

您可以使用带有插入框阴影的伪元素在底部创建淡出边框,如下所示:

body {
  background: #232323;
}

.wrap {
  box-sizing: border-box;
  position: relative;
  width: 50%;
  border: 3px solid #ffd004;
  border-radius: 50%;
}

.wrap::before {
  content:'';
  display:block;
  padding-bottom:100%;
}

.wrap::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: -3px;
  right: -3px;
  height: 100%;
  z-index: 1;
  box-shadow: inset 0px -270px 70px -100px #232323;
}

.title {
  color: #ffd004;
  margin: 0;
  position: absolute;
  top: -3px;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 2;
  background: #232323;
}

.circle {
  position: absolute;
  top:15%;
  left:15%;
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: #ffd004;
  z-index: 2;
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrap">
  <h2 class="title">Title</h2>
  <div class="circle"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

请注意,这仅适用于纯色背景。如果您需要在渐变或图像上显示它,我强烈建议使用 SVG。

使用此答案中的“填充技术”来保持圆的长宽比: Maintenance of a div with CSS