SEOlust logo SEOlust
CSS & Design Generators

CSS Triangle Generator

Generate a pure-CSS triangle in any direction — set size and color, preview it live, and copy the code. Perfect for tooltips, arrows, and ribbons. Free.

All tools

💡 How it works

  • The triangle is made from a zero-size element with thick, mostly-transparent borders — a classic CSS trick.
  • Adjust the width and height to change the triangle's proportions.
  • Great for tooltips, dropdown arrows, ribbons, and speech bubbles.

Free CSS Triangle Generator

Generate a pure-CSS triangle in any direction and copy the code instantly. Choose the direction, set the width, height, and color, and preview it live — then paste ready-to-use triangle CSS. Perfect for tooltips, dropdown arrows, ribbons, and speech bubbles. Free, no sign-up.

How CSS triangles work

You cannot draw a triangle directly in CSS, but there is a clever, widely-used trick: give an element zero width and height, then add thick borders. Because adjacent borders meet at a 45-degree diagonal, making three of the four borders transparent and one border a solid color leaves a triangle. This generator handles the math for you and outputs the exact border values for the direction you choose.

How to use the triangle generator

It is instant:

  • Pick a direction — up, down, left, right, or a corner.
  • Adjust the width and height to control the triangle's shape.
  • Choose the color.
  • Copy the generated CSS and apply it to an element.

Common uses for CSS triangles

Triangles made this way are everywhere in interfaces:

  • Tooltip and popover arrows that point at their trigger.
  • Dropdown and select caret indicators.
  • Speech-bubble tails on chat messages.
  • Ribbon ends and folded-corner effects.
  • Play buttons and simple directional icons.

Attaching a triangle to a tooltip or bubble

The usual pattern is to create the triangle with a ::before or ::after pseudo-element and position it absolutely against its parent — for example, a downward triangle placed at the bottom center of a tooltip so it points at the element below. Match the triangle's color to the tooltip's background so it looks like a seamless tail. Because the triangle is pure CSS, it scales crisply and adds no extra image request.

Triangles vs clip-path

The border trick is the most compatible way to make a triangle and works in every browser, which is why it remains popular for small UI arrows. For more complex shapes, or when you want to clip actual content rather than draw a solid triangle, the clip-path property is more flexible. Use the border method for tiny arrows and carets, and reach for clip-path when you need polygons, stars, or to shape an image.

Pro tip

Keep the triangle color as a CSS variable so a tooltip's tail always matches its background automatically. When placing a triangle as a pseudo-element, remember it has no content — set its content to an empty string and use position: absolute. For arrow-heavy UI shapes, our Clip-Path Generator complements this tool nicely.

FAQ

Is this CSS Triangle Generator free?
Yes. It is completely free, runs in your browser, and requires no account or sign-up.
How do you make a triangle in CSS?
Give an element zero width and height, then add thick borders where three sides are transparent and one is a solid color. The colored border becomes the triangle. This tool generates the exact values.
How do I change the triangle's direction?
Pick a direction in the tool — up, down, left, right, or a corner. It adjusts which border is colored and which are transparent to point the triangle the right way.
How do I add a triangle arrow to a tooltip?
Create the triangle with a ::before or ::after pseudo-element, position it absolutely against the tooltip, and match its color to the tooltip's background so it looks like a pointer.
Why is my triangle not showing?
Make sure the element has zero width and height and that only one border has a color while the others are transparent. Any content or set dimensions will break the shape.
Should I use the border trick or clip-path?
Use the border trick for small UI arrows and carets — it works everywhere. Use clip-path for complex polygons or to clip real content into a triangular shape.
Do CSS triangles work in all browsers?
Yes. The border technique is supported in every browser, which is why it is the standard way to make small triangles for tooltips and carets.

Related tools

Pro tip: pair this tool with CSS Box-Shadow Generator and CSS Gradient Generator for a faster SEO workflow.