Hello everyone,

A useful code snippet to put a ribbon in the corner of an item. I use this in all of my eCommerce project that I build/maintain for my clients. And I hope it will be useful to you. It is an Easy and minimal code snippet.


<div class="item">
  <div class="ribbon-wrapper">
    <div class="ribbon">$100 Off</div>


body {
  background-color: #28a1f5;

  width: 250px;
  height: 300px;
  background: #fff;
  display: block;
  margin: 50px auto 0;
  border-radius: 5px;
  box-shadow: 0 3px 3px 0 rgba(0,0,0,0.2);
  position: relative;

  #background: #ccc;
  width: 100px;
  height: 100px;
  position: absolute;
  right: -3px;
  top: -3px;
  overflow: hidden;

.ribbon-wrapper .ribbon{
  position: relative;
  width: 130px;
  height: 40px;
  transform: rotate(45deg);
  right: -4px;
  top: 11px;
  color: #fff;
  text-align: center;
  line-height: 40px;
  font-family: Open Sans;
  background: #f4ab66;
  background: -moz-linear-gradient(top,  #f4ab66 0%, #f28130 100%);
  background: -webkit-linear-gradient(top,  #f4ab66 0%,#f28130 100%);
  background: linear-gradient(to bottom,  #f4ab66 0%,#f28130 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4ab66', endColorstr='#f28130',GradientType=0 );
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.3);

.ribbon-wrapper .ribbon:before, .ribbon-wrapper .ribbon:after{
  position: absolute;
  content: "";
  border-top: 3px solid #c3590d;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  left: 0px;
  bottom: -3px;

.ribbon-wrapper .ribbon:after{
  right: 0;
  left: auto;