边框半径的透明背景

时间:2015-03-02 12:05:52

标签: html css css3 css-shapes

我想用CSS \ html在边框半径内创建弧透明。事实上,我希望角落div是透明的,并显示页面的底部。

.corner{
    float:right;
    border-top-left-radius:60%;
    width:50px;
    height:48px;
    margin-top:2px;

    background:#fff;
    background:rgba(f,f,f,0.1);
}
.div{
    background-color: rgb(50,20,70);
    width:130px;
    height:50px;

}
.left{
    float:left;
    width:70px;
    height:48px;
    margin-top:2px;
    color:white;
}
 <div class="div">
                 <div class="left">345345</div>
                 <div class="corner"></div>
             </div>

1 个答案:

答案 0 :(得分:4)

您可以使用框阴影在.corner上保持透明背景:

.corner {
  float: right;
  border-top-left-radius: 60%;
  width: 50px;
  height: 48px;
  margin-top: 2px;
  box-shadow:0 0 0 500px rgb(50, 20, 70);
}
.div {
  overflow:hidden;
  width: 130px;
  height: 50px;
}
.left {
  float: left;
  width: 70px;
  height: 48px;
  margin-top: 2px;
  color: white;
}

body{
  background:url('http://lorempixel.com/output/people-q-c-640-480-7.jpg');
  background-size:cover;
<div class="div">
  <div class="corner"></div>
  <div class="left">345345</div>  
</div>