JSFiddle - React, Tailwind, and code Playground
by azbuco
HTML
<div class="lines">
<div class="line line-1">This is the first row, it has quite long text</div>
<div class="line line-2">The second is significally shorter</div>
<div class="line line-2 line-3">Third is even shorter</div>
<div class="line line-2 line-3 line-4">Fourth is short</div>
<div class="line line-2 line-3 line-4 line-5">Fifth row</div>
<div class="line line-2 line-3 line-4 line-5 line-6">6</div>
</div>
CSS
body {
font-size: 30px;
font-family: system-ui;
font-weight: 500;
}
.lines {
display: flex;
flex-direction: column;
align-items: center;
}
.line {
background: lightgray;
border-bottom-left-radius: 20px;
padding: 5px 20px;
position: relative;
}
.line-2:before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 40px;
height: 40px;
display: block;
transform: translateX(-100%);
background: red;
}
.line-3:before {
border-radius: 20px;
}
.line-4:before {
box-shadow: 20px -20px 0 darkgray
}
.line-5:before {
background: transparent;
}
.line-6:before {
box-shadow: 20px -20px 0 lightgray;
z-index: -1;
}