Tool guide
About this tool.
- A border triangle is a box with zero width and height whose borders meet at an angle. Two borders are transparent and the third is colored, so only a triangle is visible.
- Size is the border width. An up or down triangle is 2 × Size wide and Size tall; left and right triangles swap those axes.
- The result is plain CSS on a .triangle element, with no image or SVG file, and the live preview uses the same border declarations.
- Create dropdown carets, tooltip and popover arrows, breadcrumb separators or decorative pointers.
- Check direction and size visually instead of working out which border gets the color.
- Use a hex or rgba() color with transparency to match a semi-transparent tooltip.
- Copy the .triangle rule and position it in your own layout.
Choose Up, Right, Down or Left in Direction, or pick a sample from Apply sample.
Drag Size from 1 to 200 px; the visible base is twice that size.
Pick a hue with the Color picker or type a hex or rgb()/rgba() value in Color; the picker keeps the current alpha.
Copy the CSS or download triangle.css and the css-triangle-report.json audit.
- Size 16, Down, #1e293b → border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 16px solid #1e293b; a 32 × 16 px caret.
- Size 32, Up, #2563eb → border-bottom: 32px solid #2563eb; with transparent left and right borders, 64 px wide and 32 px tall.
- Size 24, Right, #2563eb → border-left: 24px solid #2563eb; with transparent top and bottom borders, 24 px wide and 48 px tall.
- Color rgba(37,99,235,0.25) → border-bottom: 48px solid rgba(37,99,235,0.25); the color is kept as written, alpha included.
- Color blue → error asking for a hex or comma-form rgb()/rgba() color, such as #0000ff.
- Size is a whole number of pixels from 1 to 200. Up and down triangles are 2 × Size wide and Size tall; left and right ones are Size wide and 2 × Size tall.
- Color accepts #RGB, #RGBA, #RRGGBB, #RRGGBBAA and comma-separated rgb()/rgba(). Named colors, hsl() and CSS variables are rejected rather than guessed.
- Only Up, Right, Down and Left are accepted; an unknown direction shows an error instead of falling back to Up.
- The element’s content box is 0 × 0, so it holds no text and makes a poor click target. Mark a decorative triangle with aria-hidden="true".