CSS triangles (using the border hack) are zero-byte and inherit text color via currentColor. Use them for tooltip arrows, dropdown carets, and small decorative accents where you want the shape to match surrounding text styling. Use SVG for complex shapes, crisp scaling at all sizes, or anything more complex than a triangle. Modern recommendation: clip-path: polygon(...) is more flexible than border-triangles and outputs the same byte count. Alternative: css-tricks.com's triangle tutorial covers the theory; this tool outputs the code.
/* Tooltip arrow using the classic border hack */
.tooltip::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 8px solid transparent;
border-top-color: #1f2937; /* arrow color */
}
/* Modern clip-path equivalent */
.arrow-modern {
width: 16px;
height: 16px;
background: #1f2937;
clip-path: polygon(50% 100%, 0 0, 100% 0);
}Last updated: 2026-04-23