How TO - CSS Ribbon
Learn how to create a ribbon with CSS.
How To Create a Ribbon
Step 1) Add HTML:
In this example, the ribbon belongs to a button element:
Example
<button class="btn">A button for something cool <span
class="ribbon">NEW</span></button>
Step 2) Add CSS:
Example
.btn {
border: none;
border-radius: 5px;
padding: 12px 20px;
font-size: 16px;
cursor: pointer;
background-color: #282A35;
color: white;
position:
relative;
}
.ribbon {
width: 60px;
font-size: 14px;
padding:
4px;
position: absolute;
right: -25px;
top:
-12px;
text-align: center;
border-radius: 25px;
transform: rotate(20deg);
background-color: #ff9800;
color: white;
}
Try it Yourself »
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.