JSFiddle - React, Tailwind, and code Playground
by Gregor Adams
HTML
<div id="foo">
<div id="bar">Yes we can !!!
</div>
can we be semi transparent...?<br/>
with opaque content...?<br/>
share a semi-transparent border...?<br/>
<br/>
and still use nice markup?
</div>
CSS
body{background:url('http://lorempixel.com/700/500/abstract/2/') no-repeat;}
#foo{
height:110px;
width:250px;
background:rgba(0, 0, 0, 0.6);
position:absolute;
left:150px;
top:150px;
padding:20px;
padding-left:120px;
border-right: 2px solid rgba(255,255,255,0.5);
border-bottom: 2px solid rgba(255,255,255,0.5);
color:rgb(255,255,255);
}
#foo:before {
content:'';
position:absolute;
top:0px;
left:100px;
width: 290px;
height:0px;
border-bottom: 2px solid rgba(255,255,255,0.5);
}
#foo:after {
content:'';
position:absolute;
top:100px;
left:0px;
width: 0px;
height:50px;
border-right: 2px solid rgba(255,255,255,0.5);
}
#bar {
position:absolute;
top:-100px;
left:-100px;
padding:50px;
width: 100px;
height:100px;
opacity:1;
z-index:1;
}
#bar:after{
content: '';
height:196px;
width:196px;
background: none;
border:2px solid rgb(255,255,255);
opacity: 0.5;
-webkit-transform: rotate(180deg);
position:absolute;
top:0px;
left:0px;
border-radius: 200px;
-webkit-mask-image:-webkit-linear-gradient(transparent 50%, rgb(0, 0, 0) 50%, rgb(0, 0, 0)),
-webkit-linear-gradient(0deg, transparent 50%, rgb(0, 0, 0) 50%, rgb(0, 0, 0));
background-image: -webkit-linear-gradient(transparent 50%, rgb(0, 0, 0) 50%, rgb(0, 0, 0)),
-webkit-linear-gradient(0deg, transparent 50%, rgb(0, 0, 0) 50%, rgb(0, 0, 0));
opacity: 0.6;
z-index:-1;
}