我想为这个径向渐变和div创建边框

时间:2017-02-27 22:54:28

标签: javascript jquery html css css3

这是我的代码。

div {
  height: 150px;
  margin: 5em 2em;
  background: radial-gradient(circle at top center, transparent, transparent 70px, black 70px, black);
  border-radius: 8p## Heading ##x;
  position: relative;
}

.circle {
  width: 120px;
  height: 120px;
  background: red;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}

body {
  background-image: url(http://www.fillmurray.com/1000/1000);
  background-size: cover;
}
<div>
  <span class="circle"></span>
</div>

<!--  this creates the cut in a div placing a circle on the cut and i need to put a border for the whole div even in the cut part of div.  -->

1 个答案:

答案 0 :(得分:2)

你的意思是这样的吗?:

&#13;
&#13;
div {
  height: 150px;
  margin: 5em 2em;
  background: radial-gradient(circle at top center, transparent, green 70px, black 70px, black);
  border-radius: 8p## Heading ##x;
  position: relative;
  border: 10px solid green;
}

.circle {
  width: 120px;
  height: 120px;
  background: red;
  border-radius: 50%;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}

body {
  background-image: url(http://www.fillmurray.com/1000/1000);
  background-size: cover;
}
&#13;
<div>
  <span class="circle"></span>
</div>

<!--  this creates the cut in a div placing a circle on the cut and i need to put a border for the whole div even in the cut part of div.  -->
&#13;
&#13;
&#13;