CSS components

Corner Ribbon Badge Generator

Add an eye-catching "Sale", "New" or "Best value" ribbon to any card. Pick a diagonal corner ribbon, a folded side tag or a simple pill, choose the corner and colours, and copy pure CSS.

Live preview

Runs entirely in your browser. Nothing is uploaded to any server.

Why use CSS corner ribbons

Draws the eye

Highlight the plan or product you want people to notice.

No images

Pure CSS stays sharp on every screen and is easy to restyle.

Correct geometry

The ribbon position is calculated so it sits neatly across the corner.

How to add a corner ribbon

  1. Write the labelKeep it short: Sale, New, Popular or Best value.
  2. Pick style and cornerDiagonal ribbon, folded tag or pill, in any of the four corners.
  3. Copy the CSSAdd the rb-card class to your card, or copy the ribbon rules onto your own card class.

How the diagonal ribbon is positioned

A diagonal ribbon is a normal horizontal bar rotated by 45 degrees. For it to sit symmetrically across the corner, the centre of the bar must be the same distance from the top and side edges. The generator works out the top and side offsets from the ribbon length and height so you never have to nudge pixels by hand.

The card gets overflow: hidden so the ends of the rotated bar are trimmed by the card edges. The folded tag instead sticks out of the side, and a small triangle made with borders in a darker shade creates the illusion that it wraps around the card.

Diagonal

Classic corner banner, cropped by the card.

Folded tag

Sticks out of the side with a darker fold.

Pill

A simple rounded badge inset from the corner.

Corner ribbon FAQ

Why is my diagonal ribbon not cut off at the edges?

The card needs overflow: hidden and position: relative. Both are included in the rb-card rule.

Can I use the ribbon on images?

Yes. Wrap the image in an element with position: relative and overflow: hidden, and place the ribbon span inside it.

How long can the text be?

Short labels work best. For longer text, increase the ribbon length so the words stay inside the visible part.

Is the ribbon read by screen readers?

Yes. The ribbon is real text, so "Sale" is read along with the card content.

Does the folded tag work with rounded cards?

Yes. The card keeps overflow visible for tags so the tag can stick out of the side.

Try other CSS component tools

More free tools from My Panda Toolbox.