About this tool
CSS Triangle Generator builds a triangle with the classic border trick and gives you the rule to paste into your stylesheet. Pick one of eight directions, drag the size slider from 10 to 200 px and choose a colour. The preview updates live, and the output box shows the declarations, which you can copy with one click.
The trick relies on an element with zero width and zero height, so only its borders take up space. Where borders meet they are cut diagonally, so making two neighbouring borders transparent leaves a single coloured wedge. For the up, down, left and right arrows the two side borders are transparent and the opposite side carries the colour. The slider value is the half-width of the base and also the height, so a 60 px setting gives a 120 px wide, 60 px tall arrow. The four corner options colour one border and make an adjacent one transparent, giving a right-angled triangle with legs of twice the size.
The output contains only declarations, with no selector, so wrap them in your own class or in a ::before or ::after pseudo-element with content: ''. The colour is a solid hex value from the picker. Everything is generated in your browser and nothing is uploaded.