CSS Triangle Generator
Create CSS-only triangles for tooltips, dropdowns, and speech bubbles
The triangle is drawn with CSS borders — no SVG, no images.
About this tool
A CSS triangle is a zero-width, zero-height element whose borders meet at a sharp point. By making three borders transparent and one border colored, the remaining visible border forms a triangle. This technique works in every browser and requires no images, SVGs, or JavaScript.
Example 1: Tooltip ▲ — a small 10px-wide, 6px-tall triangle pointing up, useful as the caret on a tooltip bubble. The CSS is border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 6px solid #1a1f2b;. Example 2: Corner ◢ — a 24×24px bottom-right corner triangle, often used as a ribbon tab on cards. Only border-bottom and border-left are needed; the other two sides collapse automatically.
Pick a direction, set the width and height (border thickness on each axis), choose a color, and copy the resulting CSS. The preview shows exactly how the triangle renders — hover over it to see the hit area.
FAQ
How does a CSS triangle work? ›
An element with zero width and height has four borders that meet at a point in the center. Each border fills a triangular wedge. When three borders are set to transparent and one to a solid color, the colored wedge becomes a visible triangle. The border-width values control the triangle’s dimensions.
Why use a CSS triangle instead of an SVG or image? ›
CSS triangles add zero HTTP requests, scale with layout changes, and can inherit colors from CSS custom properties. They also animate cleanly — you can transition the border color or width. For simple directional indicators (tooltip carets, dropdown arrows, ribbon corners), a CSS triangle is lighter than any other approach.
What are the corner directions (top-left, bottom-right) used for? ›
Corner triangles are commonly used as decorative ribbon tabs on cards, folded-page effects, or corner badges. They use only two borders (e.g., border-top + border-right for top-left) instead of all four, which creates a right-angle triangle anchored to one corner.
Can I add a border or outline around the triangle? ›
You cannot add a conventional outline to a CSS border triangle because the triangle IS a border. The workaround is to layer two triangles — a slightly larger one in the outline color behind a smaller one in the fill color. This generator outputs a single triangle; for outlined variants, duplicate and offset the element.
Does this work with CSS variables or dark mode? ›
Yes. Instead of a hex color, use <code>var(--tooltip-bg)</code> or any CSS custom property in the border-color position. The triangle will update automatically when the variable changes, which makes it easy to theme tooltips and dropdowns for light and dark modes.
How is this different from the CSS Clip-Path Generator? ›
This tool creates triangles using the CSS border technique — three transparent borders, one solid. The Clip-Path Generator uses the <code>clip-path: polygon()</code> property instead, which can create triangles along with circles, stars, arrows, hexagons, and custom shapes with draggable handles.