CSS RIBBON GENERATOR

Build a corner sash or banner ribbon and copy the CSS and HTML.

In short

Generate the CSS and HTML for a diagonal corner sash (top left or top right) or a banner ribbon with a swallowtail, arrow, or flat tail. You choose the text, colors, size, and an optional drop shadow, and get a ready-to-paste snippet built from plain CSS and clip-path. It runs in your browser and nothing is uploaded.

SALE
.ribbon-box {
  position: relative;
}

.ribbon-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  overflow: hidden;
  pointer-events: none;
}

.ribbon-corner span {
  position: absolute;
  top: 28px;
  right: -46px;
  width: 210px;
  padding: 6px 0;
  text-align: center;
  background: #ff6a35;
  color: #ffffff;
  font: 700 14px/1.2 system-ui, sans-serif;
  letter-spacing: 0.1em;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.35);
}

Example output (default settings)

CSS
.ribbon-box {
  position: relative;
}

.ribbon-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 140px;
  height: 140px;
  overflow: hidden;
  pointer-events: none;
}

.ribbon-corner span {
  position: absolute;
  top: 28px;
  right: -46px;
  width: 210px;
  padding: 6px 0;
  text-align: center;
  background: #ff6a35;
  color: #ffffff;
  font: 700 14px/1.2 system-ui, sans-serif;
  letter-spacing: 0.1em;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.35);
}
HTML
<div class="ribbon-box">
  <!-- your card or image here -->
  <div class="ribbon-corner"><span>SALE</span></div>
</div>

How to make a CSS ribbon

  1. 1

    Pick a style: corner sash on the top right or top left, or a banner ribbon.

  2. 2

    Type the ribbon text and choose the ribbon and text colors.

  3. 3

    Adjust the corner size, or for a banner pick the tail shape and its depth.

  4. 4

    Copy the CSS and HTML and paste them into your page.

Questions

How does the corner sash work?
A square box in the corner has overflow hidden. Inside it a wide strip is rotated 45 degrees and pushed toward the corner, so only the diagonal band shows and the ends are clipped by the box. Put the ribbon inside a parent with position: relative.
Why is the banner wrapped in an extra element when shadow is on?
The banner tail is cut with clip-path, which would also clip a shadow drawn on the same element. A drop-shadow filter on a wrapper is applied after the clipping, so the shadow follows the cut tail shape.
Can I use it on an image or card?
Yes. Put the ribbon markup inside the card or image container and give that container position: relative. The corner sash has pointer-events: none so it never blocks clicks on what is under it.
How long can the ribbon text be?
The tool limits the text to 24 characters. A corner sash fits about 6–10 characters at the default size; raise the corner size for longer words. The banner grows with its text.
Does it work in all browsers?
The output uses transforms, overflow, clip-path, and filter: drop-shadow, which all current Chrome, Edge, Firefox, and Safari versions support. No images or JavaScript are needed.

Related tools

All Color & CSS Tools →

Updated