Skip to content
ToolsOnDuty - free online tools

Search tools

Loading tool search...

CSS & Design

CSS Triangle Generator

Create a pure-CSS triangle in any direction and copy the CSS.

Free browser toolRuns in your browserNo sign-up
.triangle {
  width: 0;
  height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 60px solid #1B5DF5;
}

Pure CSS triangles use borders on a zero-size box - no images needed.

About the CSS Triangle Generator

A CSS triangle is made by giving a zero-size element thick borders, where some sides are transparent and one is coloured.

This tool builds that trick for you: choose a direction, size and colour, see it live, and copy the CSS.

It runs in your browser and needs no images.

Key features

  • Up, down, left or right
  • Adjustable size and colour
  • Live preview
  • Copy CSS

How to use

  1. 1Pick a direction.
  2. 2Set the size and colour.
  3. 3Copy the CSS.
  4. 4Apply the copied .triangle class to an empty element. The generated width and height are zero because the visible shape comes from its borders.
  5. 5Size sets border widths, not a square bounding box. An up or down triangle at 60px is 120px wide and 60px tall; a left or right triangle is 60px wide and 120px tall.
  6. 6For a tooltip pointer, add the positioning rules in your own stylesheet; the output generates the shape but does not attach it to a tooltip.

Examples

Up triangle
Output: border-bottom: 60px solid #1B5DF5;

Transparent left and right borders plus a coloured bottom border make an upward triangle.

Frequently asked questions

How does a CSS triangle work?
An element with zero width and height and thick borders shows only its borders; making three sides transparent and one coloured leaves a triangle.
Can I use it for tooltips?
Yes. CSS triangles are commonly used as the little pointer on tooltips, dropdowns and speech bubbles.
Is it responsive?
The triangle is a fixed pixel size, but you can scale it with transform or recreate it with relative units if needed.

Open a related tool to prepare your files or refine the finished result.