CSS Triangle Generator
Create pure CSS triangles using the border trick. Choose direction (up, down, left, right), size and color. Useful for tooltips, arrows and pointers. Everything in your browser.
Como funciona?
O truque das bordas aproveita um detalhe da renderização: quando um elemento tem largura e altura zero, suas bordas se encontram em diagonais. Tornando três das quatro bordas transparentes e a quarta colorida, restam apenas dois triângulos retângulos formando uma seta.
Útil para tooltips, balões de fala, indicadores de seleção e setas de carrosséis sem precisar de SVG ou imagens. Tudo no navegador.
Arrows and pointers with no SVG or images
The tiny arrow on a tooltip, the pointer on a speech bubble, the caret on a dropdown: cases too small to justify an SVG, yet annoying to hand-write. A pure CSS triangle handles them in half a dozen lines, but nobody remembers which border gets the color and which ones go transparent for each direction. Here you click one of eight directions, set width, height and color, check the preview and copy the ready block.
The trick exploits how browsers draw borders: on an element with zero width and height, the four borders meet along diagonals. Paint one and leave its neighbors transparent, and what remains is a triangle. For the four straight directions, the generator uses two side borders at half the width each, and the triangle's height becomes the thickness of the colored border; for the four corner diagonals the construction changes and it combines two full-size borders into a right triangle.
To attach it to a tooltip, paste the code into an ::after pseudo-element with position: absolute and place it against the bubble's edge, so you keep the HTML free of extra divs. The technique has clear limits: borders only take solid colors, so no gradients, no outline around the triangle, no background image inside the shape; for those, switch to clip-path or SVG. The generator accepts 20 to 400 px per side and runs entirely in your browser.
Frequently asked questions
How do I attach the arrow to a real tooltip?
Can I make the triangle with a gradient or an outline?
Why does the generated CSS have zero width and height?
Related Tools
CSS Border Radius Generator
Create custom rounded shapes with 8 independent controls (4 corners × 2 axes). Live preview and ready-to-copy CSS. Everything in your browser.
CSS Clamp Calculator
Generate CSS clamp() values for fluid typography and spacing. Enter minimum/maximum sizes and viewport widths to get a ready-to-paste clamp() function.
CSS Loader Generator
Create pure-CSS spinners and loaders in 8 styles (ring, dots, pulse, bars, etc.). Adjust color, size and speed. No libs, no GIFs. Everything in your browser.