CSS Triangle Generator
Generate a CSS triangle with the classic border trick: pick a direction, size and colour, then copy the rule. No images, no upload.
What the CSS triangle generator builds
The shape is the classic zero-size box: width and height are zero and three borders draw the edges, one of them coloured and the other two transparent. The transparent borders are the two sloping sides, so their width sets the base while the coloured border width sets the height. Nothing is rotated, so the triangle stays crisp at any zoom and needs no transform or overflow trick. Two limitations are worth knowing: the shape is a border box, so it cannot take a background image or a gradient without a second element, and the browser mitres the corners, which makes the point look very slightly rounded at some zoom levels. Both are cosmetic and both are visible only at large sizes.
How to use it
Pick a direction, move the size slider and choose a colour, then press Run. The rule draws the triangle from borders alone, so the page ships no image and the markup needs no extra element.
Worked example
Input:
direction: up, size: 72px, colour: #0ea5e9
Output:
.triangle {
width: 0;
height: 0;
border-left: 72px solid transparent;
border-right: 72px solid transparent;
border-bottom: 72px solid #0ea5e9;
}
Why it runs in your browser
The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.
The shape is the classic zero-size box: width and height are zero and three borders draw the edges, one of them coloured and the other two transparent. The transparent borders are the two sloping sides, so their width sets the base while the coloured border width sets the height. Nothing is rotated, so the triangle stays crisp at any zoom and needs no transform or overflow trick. Two limitations are worth knowing: the shape is a border box, so it cannot take a background image or a gradient without a second element, and the browser mitres the corners, which makes the point look very slightly rounded at some zoom levels. Both are cosmetic and both are visible only at large sizes.
Generate a CSS triangle with the classic border trick: pick a direction, size and colour, then copy the rule. No images, no upload.
How to use it
Pick a direction, move the size slider and choose a colour, then press Run. The rule draws the triangle from borders alone, so the page ships no image and the markup needs no extra element.
Why it runs in your browser
The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.
What to Expect
What this tool keeps
- The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.
Sample input
direction: up, size: 72px, colour: #0ea5e9
Sample output
.triangle { width: 0; height: 0; border-left: 72px solid transparent; border-right: 72px solid transparent; border-bottom: 72px solid #0ea5e9; }
Frequently asked questions
How do I use the css triangle generator?
Pick a direction, move the size slider and choose a colour, then press Run. The rule draws the triangle from borders alone, so the page ships no image and the markup needs no extra element.
Is my input uploaded?
Nothing is uploaded. The result is produced on this page.
Is there a size limit?
No: nothing is pasted, so there is no input size to exceed.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.