A working CSS border triangle uses a zero-size element, two transparent slope borders, one colored pointing border, and valid generator inputs.
When you cannot generate one, determine whether invalid input blocked the output, valid CSS was pasted but not applied, or the requested shape needs a different technique. Work through those cases in that order so you do not rewrite code that is already correct.

Classify the failure before editing CSS
A generation failure means no complete code was produced. The CSS Triangle Generator rejects unsupported directions, malformed colors, decimal dimensions, and dimensions outside its accepted range rather than guessing the intended value. When that happens, correct the invalid field and generate the code again; there is no partial output to troubleshoot.
A display failure means complete CSS and HTML exist, but the triangle is not appearing in the destination page. The generated class may not match between the two outputs, the stylesheet may not be loading, or another rule may be overriding the zero dimensions or border declarations. If the generator preview works but the page does not, the problem is in the destination CSS rather than the generated geometry.
A design failure means the triangle renders but cannot meet the requested appearance. A border triangle is a solid, straight-edged shape, so rounded tips, hollow forms, gradients, strokes, and arbitrary polygons require another technique. Identifying this distinction prevents repeated adjustments to valid CSS.
Run the generator’s input preflight
Check the direction, both dimensions, and the color before generating. These are interacting requirements: a technically valid color cannot compensate for an unsupported direction, and the requested width and height must both be whole numbers within the generator’s range.
| Input | Accepted value | Result of an invalid value |
|---|---|---|
| Direction | Up, down, left, or right | An unsupported direction is rejected. |
| Width and height | Whole values from 10 through 300 pixels | Decimals and values outside the range are rejected, not clamped. |
| Color | A hash followed by exactly six hexadecimal digits | A malformed color is rejected; a valid color is normalized to lowercase. |
The page controls constrain ordinary entries, while the underlying generator also rejects unsupported programmatic input rather than silently correcting it. These direction and dimension limits are local rules for this tool, not universal CSS triangle standards.
Generate, inspect, and copy the border triangle
- Open the CSS Triangle Generator, choose the triangle’s direction, set its visible width and height, and select a six-digit HEX color.
- Inspect the live CSS preview at approximately the size and on the background where the triangle will appear. This confirms the border geometry, but it does not prove the final component’s accessibility or layout behavior.
- Copy both the CSS and HTML outputs. The page requests clipboard permission separately for each format, and a successful status identifies the format copied. If browser policy denies clipboard access, select the code manually from the visible blocks instead of assuming the copy succeeded.
- Paste both outputs into the project and keep their class names synchronized. Keep the triangle aria-hidden when it is purely decorative. If it communicates state, direction, validation, navigation, or another meaning, add visible text or an accessible label to the surrounding semantic control while continuing to hide the empty decorative shape.
Generation and copying occur entirely in the current browser tab. There is no upload, account requirement, server rendering, or saved design state. The copied snippet contains no script, event handler, inline image, remote request, or dependency, and the generator itself does not require SVG, canvas, an image file, or a pseudo-element library.
Confirm that the border geometry is valid
The element’s content width and height are both zero. Its visible area comes from the borders: two transparent borders form the slopes, while one colored border forms the pointing edge. Changing the element’s content dimensions after generation can therefore make the result look wrong even when the border values remain unchanged.
- An up triangle uses transparent left and right borders plus a colored bottom border.
- A down triangle uses transparent top and bottom borders plus a colored top border.
- A left triangle uses transparent top and bottom borders plus a colored right border.
- A right triangle uses transparent top and bottom borders plus a colored left border.
For vertical triangles, the transparent side borders add up to the selected width, and the colored border equals the selected height. For horizontal triangles, the transparent top and bottom borders add up to the selected height, while the colored border equals the selected width. Even dimensions divide equally; odd dimensions use adjacent floor and ceiling values, preserving the requested painted total when Chromium quantizes fractional border widths.
The generator writes each border longhand explicitly so the geometry remains easy to inspect and audit. Its live preview uses the same derived declarations as the CSS output, although final rasterization can still vary with zoom and device pixel ratio. MDN’s CSS backgrounds and borders guide explains border widths, styles, colors, and transparent color behavior, while the CSS Backgrounds and Borders Level 3 specification defines the longhand properties used by the technique.
Repair the copied code in the destination page
Confirm that you pasted both outputs, that the HTML uses the same class as the CSS, and that no later stylesheet rule replaces the zero width, zero height, or border declarations. The generated class is named lizely-triangle. If that name conflicts with an existing rule, rename it in the CSS and HTML together rather than changing only one output.
Also inspect the triangle inside its real container. Its measurable content box is zero while its painted borders occupy space, so layout, transforms, hit testing, outlines, overflow, and alignment can be less intuitive than with an SVG that has an explicit viewBox. Testing the surrounding component is more reliable than judging the triangle in isolation.
For the accessibility decision, why aria-hidden is only safe for a decorative CSS triangle explains the distinction between a decorative shape and a meaningful indicator. Do not expose an empty generated div as the only source of meaning.
Switch techniques when the shape requirement is too complex
Border triangles remain useful for compact, solid arrows and separators. They cannot directly create some common visual treatments. If you were aiming for a curved tip or outline, the generator’s limits on rounded and outlined triangles show where the border method ends.
| Requirement | Border-triangle result | Recommended approach |
|---|---|---|
| Straight, solid arrow or separator | Supported in four directions | Use the generated border CSS. |
| Rounded tip, curved edge, hollow form, gradient, stroke, complex shadow, or arbitrary polygon | Not directly supported | Use SVG or clip-path and test browser support in the intended environment. |
| Responsive scaling based on an explicit viewBox | The content box remains zero while painted borders occupy space | Consider SVG when predictable intrinsic geometry is required. |
| Theme-dependent or alpha-based color | The generator accepts only an opaque six-digit HEX color | After copying, replace the literal with a trusted design token and verify that the transparent borders remain transparent. |
CSS variables, currentColor, alpha colors, gradients, wide-gamut color syntax, and theme tokens are not generated by this focused tool. A copied literal can be replaced with a trusted token when the destination supports its syntax, but the replacement should be tested separately because it no longer exactly matches the generated preview.
Verify behavior in the final component
The preview confirms border geometry, not the complete accessibility or layout behavior of the destination component. Check the triangle at its intended size and background, in light and dark themes, at 200 percent zoom, in high-contrast and forced-colors modes, and at common mobile widths. If it sits next to text, use the Color Contrast Checker to assess the relevant text and background colors rather than assuming the decorative color inherits sufficient contrast.
Performance cost for one triangle is negligible, but hundreds of decorative elements can increase DOM and paint work. Prefer one semantic control containing a decorative shape over repeated hidden controls. This also keeps the accessibility treatment coherent: the control carries the meaning, while the CSS triangle remains a visual decoration.
If valid input still produces no code, reduce the request to a supported direction, whole-number dimensions from 10 through 300, and an exact six-digit HEX color. If complete code exists but the triangle is missing, compare the destination rules with the copied border declarations and remove class conflicts. If the shape renders but cannot satisfy the requirement, move to SVG or clip-path rather than distorting the border technique.