Guide
Design a pure CSS triangle using the classic border method. Choose from eight directions, compare isosceles, right-angle and asymmetric shapes, and inspect the same validated border rules that you copy. Separate tooltip and speech-bubble examples add a matching positioned pseudo-element and visible text. Settings and example text are processed in your browser without a processing upload.
1Choose a direction or preset
Select Up, Down, Left, Right or a diagonal corner. Apply one of ten editable presets for common arrows, small or large triangles, right angles, tooltip pointers and speech-bubble tails.
2Adjust dimensions and shape
Set width and height from 5–300px. Isosceles splits transparent borders equally, right-angle sets one to zero, and the asymmetric apex control redistributes the base without changing its total span.
3Customize color and rotation
Enter an opaque three- or six-digit HEX color or choose a swatch. Rotate from 0–360 degrees, switch preview backgrounds and scroll the preview to inspect large shapes at their actual size.
4Copy the matching HTML/CSS
Copy CSS, decorative HTML or a complete standalone example. For a tooltip or speech bubble, use the separate example controls and copy buttons. Reset restores both editors and the preview background.
A CSS border triangle starts with an element whose content width and height are zero. Borders still meet around that zero-size content box. Give one border a visible color and the adjacent borders transparent colors, and their junction creates a triangle. The generated element remains zero-size in CSS; the requested visible dimensions are represented by border widths instead of misleading width and height declarations.
An upward isosceles triangle uses equal transparent left and right borders plus a colored bottom border. A downward triangle uses a colored top border instead. The generator resets other borders and padding before writing the needed side declarations. It uses real CSS borders in both the preview and exports, without SVG or an image asset.
Up and Down use a horizontal base, while Left and Right use a vertical base. A left-pointing triangle colors the right border; a right-pointing one colors the left border. The four corner directions use two adjacent borders to fill the named corner of a rectangle. These diagonal constructions are right-angle triangles rather than a rotated copy of an unrelated shape. Decorative arrows do not supply button or navigation semantics.
Width and height each accept values between 5 and 300 pixels. For vertical triangles, transparent left and right widths add to the requested width and the colored border sets height. For horizontal triangles, transparent top and bottom widths add to height and the colored border sets width. Fractional borders may snap to device pixels in a browser, so very small or odd dimensions can have slightly different rasterized edges.
Isosceles uses equal transparent border widths. Right-angle places the apex at the start or end of the base by setting one transparent border to zero. Scalene / asymmetric exposes an apex position from 5–95 percent along the base, keeping the total span consistent. A centered apex can still produce an isosceles triangle. This model does not claim to represent every possible scalene geometry. Corner directions always use a fixed right-angle construction and retain your cardinal shape setting for later.
The color picker, HEX field and preset swatches update the same editor state. Colors are normalized with the shared opaque HEX validator before CSS serialization; alpha HEX values are not accepted. Rotation uses transform: rotate() around the border box center and appears in both preview and output. Dimensions describe the shape before rotation; the rotated bounding rectangle can be wider or taller, and the preview reserves room for it.
Choose a top, bottom, left or right pointer in the separate tooltip example. A relatively positioned text wrapper supplies the background, while its absolutely positioned ::after pseudo-element creates the matching border triangle. Base and depth range from 5–60px independently of the basic triangle dimensions. The example keeps text visible. A production interactive tooltip additionally needs an accessible trigger relationship and suitable keyboard, focus and show/hide behavior.
Speech-bubble examples support bottom-left, bottom-center and bottom-right tails. Side tails use true right-angle geometry; the center tail is a downward isosceles triangle. The wrapper and pseudo-element share one validated fill color, and text color is chosen for contrast. Edit the visible message and copy its own CSS, HTML or complete document. Basic triangle rotation is intentionally excluded from attached pointers so the join stays intact.
A border triangle is useful for a small decorative pointer made from one zero-content-size element or pseudo-element. clip-path defines a visible region on an element with its own box and is more flexible for arbitrary polygons or clipped images. Neither technique automatically makes a triangle a meaningful control. Use the related Clip Path Generator for polygon editing rather than trying to stretch this border model into every shape.
The editor uses responsive controls while the shape keeps its configured pixel dimensions. Large or rotated triangles scroll within a bounded preview instead of silently shrinking. The complete example includes a centered scene with enough room for the rotated border box. When integrating into a narrow layout, adapt border dimensions or reserve scroll space; transform rotation does not resize surrounding layout boxes. Test pointer placement with long text at the final display size.
Decorative triangle HTML uses aria-hidden=true and is not presented as a button. A button containing an arrow still needs its own accessible name. Tooltip and speech-bubble text remains ordinary readable HTML, and special characters are escaped in exports. The editor has labeled keyboard-friendly inputs, visible focus, announced errors and copy feedback, and restores focus on reset. A border shape alone does not create a complete accessible tooltip interaction.
- Adding a decorative arrow inside a named button
- Preparing a tooltip pointer for an existing accessible tooltip
- Styling a speech-bubble tail around visible text
- Comparing corner ribbons and small directional indicators
- Build eight directions with native CSS border geometry.
- Compare isosceles, right-angle and editable asymmetric triangles.
- Export separate matching tooltip and speech-bubble examples.
- Keep generated CSS bounded and example text safely escaped.
How do I create a triangle using CSS?
Start with width: 0 and height: 0, color one border and make its adjacent borders transparent. Choose a direction in the generator and copy the resulting border rules and decorative HTML.
Why does a CSS triangle use zero width and height?
The visible shape comes from the border junction rather than the content box. Nonzero content dimensions would separate those junctions and change the shape.
How do I make an upward triangle?
Choose Up. An isosceles upward triangle uses equal transparent left and right borders plus a colored bottom border whose width sets the visible height.
How do I make a downward triangle?
Choose Down. Transparent left and right borders define the base width, and a colored top border points toward the bottom.
How do I change triangle size?
Set width and height from 5–300px. The generator translates those dimensions into the appropriate borders. Dimensions describe the unrotated shape, and browsers may snap fractional borders to device pixels.
Can I rotate a CSS triangle?
Yes. Rotation ranges from 0–360 degrees and is included in exported CSS. It changes the painted orientation and bounding box without changing the original border dimensions.
How do I create a tooltip arrow?
Use the separate Tooltip pointer example, select a side and set pointer base and depth. Copy its wrapper and ::after CSS. Add your application's accessible trigger and interaction behavior when using it as a real tooltip.
Can I create triangles without images?
Yes. These shapes use CSS borders on a div or pseudo-element. They need no image, SVG or drawing library.
What is the difference between border triangles and clip-path?
Border triangles are small shapes around a zero-size content box. clip-path clips a sized element into a polygon or other silhouette and is more suitable for arbitrary shapes or clipped images.
Is the CSS Triangle Generator free?
Yes. All eight directions, ten presets, shape controls, live previews and CSS/HTML copy options are free without signup.