JSFiddle - React, Tailwind, and code Playground
HTML
<div class="picture">
<div class="ribbon ribbon-top-left">
<span>TEXT</span>
</div>
<img src="http://i.imgur.com/5lWqOGT.png" />
</div>
CSS
body {
margin: 10px;
}
img {
border-radius: 0.5vw;
height: 60vh;
/* width:100%; */
}
.picture {
position: relative;
width:100%;
}
.ribbon {
position: absolute;
left: -5px; top: -5px;
z-index: 1;
overflow: hidden;
width: 100%;
height: 100%;
text-align: right;
}
.ribbon span {
font-size: 3vh;
font-weight: bold;
color: #FFF;
text-transform: uppercase;
text-align: center;
line-height: 4vh;
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
width: 30vh;
display: block;
background: #79A70A;
background: linear-gradient(#9BC90D 0%, #79A70A 100%);
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 7.4vh;
left: -5.6vh;
}
.ribbon span::before {
content: "";
position: absolute; left: 0px; top: 100%;
z-index: -1;
border-left: 3px solid #79A70A;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #79A70A;
}
.ribbon span::after {
content: "";
position: absolute; right: 0px; top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #79A70A;
border-bottom: 3px solid transparent;
border-top: 3px solid #79A70A;
}