减去圆圈是否透明?

时间:2014-05-14 22:28:20

标签: html css css3 css-shapes

我有问题。 我正在尝试用CSS3创建一个必须透明的形状。

我还是要从div中减去一个div,让空白区域透明?

我创建了一个JSBin来显示我的问题。 我需要让绿色框变得透明,所以形状很突出。



body html {
  width: 100%;
  height: 100%;
}
#beerglass {
  position: relative;
  padding-top: 100%;
  width: 50%;
  overflow: hidden;
}
.beertop {
  position: absolute;
  width: 100%;
  height: 4%;
  border-radius: 100%;
  background: blue;
  top: 0;
  z-index: 2;
}
.beerbody {
  height: 97%;
  width: 100%;
  background: green;
  position: absolute;
  -webkit-border-top-right-radius: 1%;
  -webkit-border-bottom-right-radius: 6%;
  -moz-border-radius-topright: 1%;
  -moz-border-radius-bottomright: 6%;
  border-top-right-radius: -1%;
  border-radius: -100%;
  margin: 3% 0%;
  top: 0;
  z-index: 1;
}
.beerbottom {
  position: absolute;
  width: 85%;
  height: 4%;
  border-radius: 100%;
  background: blue;
  margin: 0% 7.5%;
  bottom: 0;
  z-index: 2;
}
.beercircle-l {
  position: absolute;
  height: 100%;
  width: 30%;
  -webkit-border-top-right-radius: 100%;
  -webkit-border-bottom-right-radius: 60%;
  -moz-border-radius-topright: 100%;
  -moz-border-radius-bottomright: 60%;
  border-top-right-radius: 100%;
  border-bottom-right-radius: 60%;
  background: green;
  margin: 0% -10%;
  top: 0;
  z-index: 3;
}
.beercircle-r {
  position: absolute;
  height: 100%;
  width: 30%;
  -webkit-border-top-left-radius: 100%;
  -webkit-border-bottom-left-radius: 60%;
  -moz-border-radius-topleft: 100%;
  -moz-border-radius-bottomleft: 60%;
  border-top-left-radius: 100%;
  border-bottom-left-radius: 60%;
  background: green;
  margin: 0% 80%;
  top: 0;
  z-index: 3;
}

<br>
<br>
<div id="beerglass">
  <div class="beertop"></div>
  <div class="beerbody"></div>
  <div class="beerbottom"></div>
  <!--<div class="beercircle-l"></div>-->
  <!--<div class="beercircle-r"></div>-->
</div>
&#13;
&#13;
&#13;

0 个答案:

没有答案