A zero-size element with strategic border widths is the entire mechanism behind a CSS border triangle, so choosing width and height in the CSS Triangle Generator means deciding how many pixels each side of that border arrangement should occupy. The width value controls the horizontal base, the height value controls the vertical reach, and the generator assigns those numbers to specific borders based on the direction you pick. Vertical triangles split the width across two transparent side borders, while horizontal triangles split the height across two transparent top and bottom borders, leaving a single colored border to carry the full pointing dimension. Every border is written explicitly in the output so the geometry stays visible and auditable when you paste the CSS into your own stylesheet. Choosing dimensions is therefore a question of border arithmetic, not ordinary box sizing, and understanding that mapping keeps each border's role visible in the generated CSS.

What the Width and Height Controls Represent
The two numeric inputs in the generator do not describe the painted size of an ordinary content box. Because the element's width and height are both zero, the visible triangle is built entirely from four borders that meet at the center. For vertical triangles, the width you enter becomes the combined width of the two transparent side borders and the height becomes the width of the colored border; for horizontal triangles, the width you enter becomes the width of the colored side border and the height becomes the combined width of the two transparent top and bottom borders. For an upward triangle, that means the colored bottom border receives the full height value, while the transparent left and right borders together receive the width value. Entering numbers therefore means assigning pixel values to specific border sides, not sizing a div, and the relationship between the two numbers is what shapes the proportions of the final arrow. Reading the generated CSS makes that mapping visible: every longhand is written out so a developer can verify which border carries which dimension.
The 10 to 300 Pixel Input Range
The generator restricts both width and height to whole values between 10 and 300 pixels inclusive. The range defines the smallest and largest whole-number inputs the tool accepts, and whether a given value fits in the destination layout depends on the container, since a 300-pixel border can still extend past a small element. Whole numbers are required because the floor and ceiling splitting rule is defined on integers, and decimal widths are rejected by the pure generator rather than silently rounded. If a smaller or larger triangle is needed for a specific design, the generated CSS is fully editable, so the border widths can be adjusted by hand in your own stylesheet after copying. The constraint is also a deliberate testing choice: covering the four-direction, odd-dimension, exact-output, and boundary cases is far more predictable when the input space stays finite. The 10-pixel floor and 300-pixel ceiling are simply the lower and upper bounds of accepted input; the contract does not claim they prevent aliasing, vanishing borders, oversized triangles relative to surrounding UI, or unnecessary paint work.
Set Triangle Dimensions in the Generator
- Open the CSS Triangle Generator and pick a direction — up, down, left, or right — that matches how the arrow should point on your page.
- Enter a width value as a whole number between 10 and 300. For vertical triangles this becomes the combined horizontal base; for horizontal triangles it becomes the length of the colored side border.
- Enter a height value as a whole number between 10 and 300. For vertical triangles this is the colored border that points up or down; for horizontal triangles it is the combined transparent top and bottom borders.
- Type a six-digit HEX color preceded by a hash, such as #1f6feb, and watch the preview update as soon as each value passes validation.
- Inspect the live preview at roughly the size and background where the triangle will sit, since proportions and contrast are easier to judge in context than against a default white canvas.
- Click Copy CSS and Copy HTML separately to grab both code blocks, then rename the lizely-triangle class in both the CSS and HTML outputs if it would clash with anything in your existing stylesheet.
Even and Odd Dimensions: Floor and Ceiling Math
A small but important rule governs odd totals in the generator: when the two transparent side borders would need to split an odd pixel value equally, the generator assigns one border the floor value and the other the ceiling value. A 41-pixel base produces 20px and 21px transparent borders instead of two 20.5px values, because Chromium can quantize two 20.5px borders down to 20px each at certain zoom levels and device pixel ratios. That one-pixel asymmetry preserves the requested total painted dimension instead of silently shrinking the triangle by a pixel. Even dimensions split cleanly, so a 40-pixel base produces two 20px transparent borders with no rounding artifacts. If pixel-perfect geometry matters for a layout, prefer even totals when possible, and verify the painted result at the zoom level and DPR your audience actually uses.
| Requested base | Transparent borders | Notes |
|---|---|---|
| 40px (even) | 20px + 20px | Clean integer split |
| 41px (odd) | 20px + 21px | Floor and ceiling rule |
| 60px (even) | 30px + 30px | Symmetric paint |
| 61px (odd) | 30px + 31px | One-pixel asymmetry |
How Vertical and Horizontal Triangles Use the Numbers
The numeric mapping changes depending on which way the triangle points. For vertical triangles (up and down), the two transparent side borders add up to the width you typed, and the single colored border equals the height you typed. For horizontal triangles (left and right), the transparent top and bottom borders add up to the height you typed, and the colored side border equals the width you typed. Up uses transparent left and right borders with a colored bottom border; down uses a colored top border; left uses transparent top and bottom borders with a colored right border; right uses a colored left border. Understanding this mapping lets you reverse-engineer the dimensions you need: if a tooltip arrow should sit flush against a 24-pixel-tall label, typing a height of 24 with an up or down direction makes the colored border exactly match the label height.
| Direction | Transparent borders | Colored border | What splits |
|---|---|---|---|
| Up | Left + right | Bottom | Width |
| Down | Left + right | Top | Width |
| Left | Top + bottom | Right | Height |
| Right | Top + bottom | Left | Height |
Testing Dimensions Before You Copy the Code
A live preview is the fastest way to confirm that the dimensions you typed actually produce the triangle you imagined. Check it at the approximate size and against the background where the shape will live, because a 60-pixel red arrow that reads well on white can disappear against a brand-colored card. Borders are painted as opaque HEX, so alpha, gradients, currentColor, and CSS variables are not generated by this focused tool — verify that swapping the literal for a design token after copying still renders correctly and keeps the transparent side borders transparent. Test the final result at 200 percent zoom, in high-contrast mode, in forced-colors mode, and on common mobile widths, since rasterization can shift at different device pixel ratios even when the CSS is identical. For a deeper look at how border properties and transparent colors behave in CSS, the MDN CSS backgrounds and borders guide documents the underlying longhand properties in detail. The preview confirms border geometry, not the full accessibility or layout behavior of the surrounding component, so pair it with a visual check on the destination page before you ship.
Limits and Alternatives When Dimensions Won't Cut It
Border triangles are compact, but their geometry is constrained by the zero-size trick. The element's measurable content box is zero while its painted borders occupy space, which makes layout, transforms, hit testing, outlines, overflow, and alignment less intuitive than an SVG with an explicit viewBox. Border triangles also cannot directly create a rounded tip, curved edge, hollow shape, gradient fill, stroke, complex shadow, or arbitrary polygon. If any of those are part of the design — for example, a tooltip arrow that needs a soft shadow or a chevron with rounded corners — the Make Rounded or Outlined CSS Triangles: Generator Limits guide covers the full picture, after which switching to SVG or clip-path and verifying browser support in the intended environment is the practical path. Hundreds of decorative triangles increase DOM and paint work as well, so prefer one semantic control with a single decorative shape over duplicated hidden controls that each carry their own border declarations. Dimensions can also be made responsive after copying by wrapping them in a CSS variable and deriving borders with calc(), which lets the triangle scale with the root font size while preserving the same proportions the generator produced.
Related reading: What to Verify in a Generated CSS Checkbox Before Shipping.