CSS Triangle Generator
Generate CSS triangles in 8 directions with the classic border trick or a modern clip-path — tune width, height, and color with a live preview. Export CSS, SCSS, Tailwind, or JS.
About this ToolHow it works, benefits & use casesTap to collapse
Pure-CSS triangles power tooltips, dropdown carets, ribbons, and speech bubbles — and this generator builds them two ways without you memorizing the math. Pick one of eight directions from the compass grid (up, down, left, right, and all four diagonals), then choose the classic border trick (a 0×0 element whose borders form the shape) or a modern clip-path (a real-sized element clipped to a polygon). Width and height map to the triangle's base and height in both modes, and a color picker with a paired hex field sets the fill. The dotted-canvas preview redraws instantly as you drag the size sliders. When it looks right, export it as CSS, SCSS, a Tailwind arbitrary-value class, or a JS inline-style object, then copy, download, or share via URL.
How to Use
- 1Click a direction in the 3×3 compass to point the triangle up, down, left, right, or toward any corner.
- 2Choose a Method: "Border trick" for a bulletproof 0×0 element, or "Clip-path" for a real element that can hold content or a background.
- 3Drag the Width and Height sliders to set the triangle's base and height (2–400px each).
- 4Set the fill with the color swatch or type a value into the hex field next to it.
- 5Pick an Output format (CSS, SCSS, Tailwind, or JS), then copy, download, or share the snippet.
Key Benefits
- Eight directions chosen from a visual compass, including all four diagonals
- Two techniques: the classic border trick or a modern clip-path polygon
- Live dotted-canvas preview that mirrors the exported code exactly
- Independent width and height control over the triangle's base and height
- Color picker paired with an editable hex field
- Exports to CSS, SCSS, a Tailwind arbitrary value, or a JS inline-style object
- Runs entirely in the browser with a shareable URL for every shape
Common Use Cases
- Adding a caret to a tooltip, popover, or dropdown menu
- Drawing speech-bubble tails and notification pointers
- Building corner ribbons and folded-tag decorations
- Creating play-button and chevron icons without an SVG asset
- Learning how the CSS border trick produces a triangle from a zero-size box
140×110px • border trickDirection
Method
Size & color
Copy, download, share, or pipe to another tool
.triangle {
width: 0;
height: 0;
border-left: 70px solid transparent;
border-right: 70px solid transparent;
border-bottom: 110px solid #6366f1;
}Two ways to draw a triangle
The border trick sizes a 0×0element's borders so the colored side becomes a triangle — bulletproof in every browser, great for tooltips and carets. Clip-pathclips a real element to a triangle, so it can hold content or a background image. Width and height map to the triangle's base and height either way.
Was this tool helpful?
Share Your Experience
Help others discover this tool!
Related tools
- CSS FormatterFormat and beautify CSS code
- Skeleton Screen GeneratorBuild layout-matched skeleton loaders (card/list/article/table) with shimmer/pulse/wave and a live preview
- Spacing Scale CalculatorLinear, geometric, Fibonacci or modular spacing scales with a visual ruler preview and utility classes — export CSS, Tailwind v4, SCSS, JSON
- Transition & Easing StudioDrag a cubic-bezier curve, play it on a live demo, and export CSS, @keyframes, Tailwind, Framer, or WAAPI
- CSS MinifierMinify CSS code
- Design Token GeneratorPerceptual colour ramps + light/dark semantic tokens, live preview, WCAG audit — export CSS, Tailwind v4, W3C DTCG & more
The border trick sizes a 0×0 element's borders so the colored side becomes a triangle — it works in every browser and is ideal for tooltip carets and pointers. Clip-path clips a real, sized element to a triangular polygon, so that element can still hold content or a background image. Both interpret the width and height as the triangle's base and height.
You can point it up, down, left, or right, plus all four diagonals (top-left, top-right, bottom-left, bottom-right), selected from a 3×3 compass grid. The eight options cover carets and corner decorations alike.

