Ribbon badge
Ribbon css badge, product badge new, css flat button shape
by Vishnuprasad ps
HTML
<div dir="ltr">
<div class="bg-new">
NEW
<span />
</div>>
</div>
SCSS
body {
font-family: sans-serif;
}
.bg-new {
display: inline-flex;
align-items: center;
position: relative;
height: 16px;
color: white;
font-size: 0.875rem;
font-weight: normal;
text-decoration: none;
border: 0;
border-radius: 0;
margin: 0;
padding: 0.5rem;
background-color: #1ba177;
&::after {
content: '';
position: absolute;
top: 0;
width: 0;
height: 0;
border-style: solid;
border-color: transparent #1ba177;
z-index: 1;
[dir="ltr"] & {
right: -16px;
border-width: 16px 0 16px 16px;
}
[dir="rtl"] & {
left: -16px;
border-width: 16px 16px 16px 0;
}
}
span {
position: absolute;
top: 0;
z-index: 1;
[dir="ltr"] & {
right: -12px;
}
[dir="rtl"] & {
left: -12px;
}
&::after {
content: '';
position: absolute;
top: 0;
height: 0;
width: 0;
border-style: solid;
border-width: 16px;
opacity: 1;
z-index: 2;
[dir="ltr"] & {
right: -20px;
border-color: #53dab6 transparent #53dab6 #53dab6;
}
[dir="rtl"] & {
left: -20px;
border-color: #53dab6 #53dab6 #53dab6 transparent;
}
}
}
}