ToolPal

CSS Triangle Generator

Generate pure-CSS triangles using the border trick. Pick a direction, size, and color — copy the CSS instantly.

CSS triangles use the border trick: a zero-size element with transparent borders on three sides and a solid color on the fourth produces a triangle. No SVG or images required.

How to Use

Generate pure-CSS triangles using the border trick. Pick a direction, size, and color — copy the CSS instantly.

  1. 1Pick the triangle direction — up, down, left, right, or a corner direction for right triangles.
  2. 2Drag the width and height sliders to set the triangle's size in pixels.
  3. 3Choose a color using the color picker or by typing a hex value.
  4. 4Watch the live preview update on a checkered background so transparent borders are visible.
  5. 5Click 'Copy' to copy the generated CSS class to your clipboard and paste it into your stylesheet.

Key Features

  • Eight directions — four cardinal (up/down/left/right) and four corner-anchored right triangles
  • Live preview on checkered background — confirms which borders are transparent and which are colored
  • Independent width and height — sliders go up to 400px for both dimensions
  • Pure-CSS output — no SVG, no images, no JavaScript runtime; just borders on a zero-size element
  • Color picker plus hex input — choose visually or paste an exact brand color

Frequently Asked Questions

Learn More