div.bdr {
padding-bottom: 5px;/* Used to create a transparent line */
background: #1B4046;
background-clip: content-box;/* Adds a 5-pixel transparent line */
box-shadow: -273px 5px 0 #1B4046, 274px 5px 0 #1B4046;
/* Shadows are moved away to create partial drawings
Note: Wrapper must hide overflow */
margin-bottom:2em;
}
.bdr.bg-color{
background-color: tomato;
background-image: linear-gradient(to top, transparent 5px, #1B4046 5px);
background-clip: border-box;
}
div.bdr:after {
content: '';
height: 30px;
width: 30px;
padding: 5px;
display: block;
margin: auto;
z-index: -1;
transform: rotate(45deg);
margin: -20px auto -20px;
background: #1B4046;
background-clip: content-box;/* Keep some parts transparent */
box-shadow: 6px 6px 0 -1px #1B4046;
}
.bdr.bg-color:after {
z-index: 0;
padding: 5px 0 0 5px;
border: 5px solid transparent;
border-left: 0;
border-top: 0;
box-shadow: 6px 6px 0 -1px #1B4046;
background: linear-gradient(to bottom right, transparent 50%, #1B4046 50%) no-repeat, linear-gradient(to bottom right, transparent 50%, tomato 50%) 5px 5px no-repeat;
}
article {
width: 500px;
margin: auto;
color: white;
}
h1 {
text-align: center;
}
div.shapebdr {
padding-bottom: 40px;
margin: 32px 0;
background: linear-gradient(to top, transparent 30px, #1B4046 30px, #1B4046 35px, transparent 35px) bottom left, linear-gradient(to top, transparent 30px, #1B4046 30px, #1B4046 35px, transparent 35px) bottom right, linear-gradient(to top, transparent 40px, #1B4046 40px) bottom;
background-repeat: no-repeat;
background-size: 230px 100%, 230px 100%, 100% 100%;
position: relative;
}
div.shapebdr:after {
content: '';
height: 40px;
width: 40px;
padding: 10px;
display: block;
margin: auto;
z-index: -1;
background: inherit;
transform: rotate(45deg);
margin: -40px auto -20px;
background: linear-gradient(to top, #1B4046, #1B4046) no-repeat, linear-gradient(to top, #1B4046 0, #1B4046 5px, transparent 5px) no-repeat right, linear-gradient(to left, #1B4046 0, #1B4046 5px, transparent 5px) no-repeat bottom right;
background-clip: content-box, border-box, border-box;
background-size: auto auto, 57% 100%, 100% 57%;
}
div.br:after {
margin: auto;
margin-bottom: -40px;
}
article {
overflow: hidden;
padding-bottom: 40px;
}
html {
min-height: 100%;
background: linear-gradient(30deg, gray, yellow, purple, lime, tomato, turquoise, gray);
}
p {
padding: 0.25em;
margin: 0.25em;
position: relative; /* Ensure text displays over the pseudo element */
}
<article>
<h1>Border and Shadow Approach</h1>
<div class="bdr">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus at blandit felis. Etiam ultricies turpis vel enim vulputate, ut iaculis justo varius. Proin id placerat purus. Nam auctor venenatis felis non pretium.</p>
</div>
<h1>Gradient Approach</h1>
<div class="shapebdr">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus at blandit felis. Etiam ultricies turpis vel enim vulputate, ut iaculis justo varius. Proin id placerat purus. Nam auctor venenatis felis non pretium.</p>
</div>
<h1>Shadow + Gradient Approach to Create Translucent Line</h1>
<div class="bdr bg-color">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus at blandit felis. Etiam ultricies turpis vel enim vulputate, ut iaculis justo varius. Proin id placerat purus. Nam auctor venenatis felis non pretium.</p>
</div>
</article>