World’s largest virtual agentic engineering & quality conference
This free tool allows you to generate CSS triangles with live preview and copy-ready border, clip-path, or SVG code.
Pick where the tip points.
How the triangle is drawn.
Equal sides, or a shifted tip.
How wide the triangle is.
How tall the triangle is.
Spin the triangle.
Pick a color or paste a hex.
Updates as you change the controls.
Generate
A CSS triangle generator is a browser tool that writes triangle CSS from direction, size, and color. It follows the border-width rules in CSS Backgrounds and Borders Module Level 3, or clip-path: polygon() from CSS Masking Module Level 1. You copy the result into a stylesheet.
TestMu AI keeps the math in your tab. All processing happens in your browser. No data is uploaded. Pair it with the CSS Grid Generator when the triangle sits inside a layout cell.
The border method sets width and height to 0. The four borders still take space. Make three borders transparent and one colored, and the remaining piece is a triangle. MDN documents this on the border-width property.
A default up triangle in this tool uses border-width 0 50px 80px 50px and border-color transparent transparent #121212 transparent. That is a 100px base and an 80px altitude. clip-path instead keeps a real 100 by 80 box and cuts it with polygon points from the CSS Masking Module Level 1 spec.
SVG output writes a polygon with three points. The Pseudo-element method moves the same border CSS onto ::after so a tooltip or button can keep its own box.
Layout around the triangle often uses Flexbox Generator for the trigger row. Shadows on nearby cards belong in Drop Shadow Generator, not on the zero-size border box.
| Border trick | clip-path polygon | SVG polygon |
|---|---|---|
| Width and height must be 0 | Element keeps real width and height | Uses width and height on the svg element |
| Solid fill only | Background, image, or gradient can show | fill, stroke, and viewBox scale |
| Works in Internet Explorer 8 | Not supported in Internet Explorer 11 | Works where inline SVG works |
| Hard to put a stroke on the slanted edge | A CSS border is clipped away with the box. See MDN clip-path | stroke draws on the three edges |
Filter experiments such as blur on a nearby photo belong in the CSS Filter Generator. Contrast of the triangle against page chrome is an accessibility testing concern when the fill is a pale gray on white.
A CSS triangle is a styled HTML element, not a PNG or SVG file you host. The border method uses a zero-size box whose colored border forms the shape. clip-path cuts a filled box to three points. Both render as CSS, so there is no extra image request.
Set type to Equilateral and pick up, down, left, or right. The generator sets the altitude to the base times the square root of 3, divided by 2. That is the same ratio as an equilateral triangle in Euclidean geometry. Width and height stay locked while that type is selected.
Choose Left or Right on the direction pad. In the border method the colored side sits opposite the tip. A left-pointing triangle uses a colored right border and transparent top and bottom borders. clip-path uses polygon(0% 50%, 100% 0%, 100% 100%) for left.
The border method cannot. Transparent and solid border colors meet at a hard edge, so a gradient has nowhere to sit. Switch the method to clip-path. The clipped box is a normal element, so a linear-gradient background can show through the triangle. Pair this tool with the Gradient Generator if you need color stops.
The border method uses only border-width, border-style, and border-color, which current browsers support, including Internet Explorer 8. clip-path polygon() is not supported in Internet Explorer 11, which Can I Use still lists as unsupported. SVG triangles work wherever inline SVG works.
Generate a small triangle that points toward the tooltip. Copy the CSS, then position the triangle with absolute offsets on the tooltip edge. The Pseudo-element method puts the shape on ::after so the tooltip box keeps its own background and padding.
clip-path polygons can transition in browsers that interpolate clip-path. Border widths can transition as lengths. Rotation uses transform, which animates smoothly. This generator writes static CSS. You add transition or animation rules in your own stylesheet.
Pick a diagonal direction such as Up right. The border method colors one border and makes the adjacent border transparent, so the two legs meet at 90 degrees. Width and height are the two legs. clip-path uses three corner points of the box.
Click Generate, then the copy icon beside the CSS output. The page waits for the clipboard write to finish, then shows a green toast. If the browser blocks clipboard access, an error appears under the output. Download saves a .css file.
No. Direction, size, color, and the generated CSS stay in memory in your browser. There is no account, no server round trip, and no localStorage write. Close the tab and the values are gone.
Use a small down triangle, often 8 to 12 pixels tall, in the same color as the trigger text. Place it next to the label with inline-block or a flex row. For a caret that looks like a chevron rather than a filled triangle, a rotated square is a different pattern.
Yes. The rotation slider applies transform rotate() in degrees clockwise. Direction still sets the base shape. Rotation of 180 degrees on an up triangle is the same silhouette as a down triangle, with a different transform.
The most common miss is forgetting border-style solid. Width and height must be 0 in the border method, or the colored borders sit around a rectangle. Another miss is a parent with overflow hidden clipping the borders. Check the generated CSS against the preview in this tool.
Did you find this page helpful?
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance