Learn two easy ways to draw a crisp 6-point star with pure CSS, perfect for badges, icons, and decorative UI elements, in just a few lines of code.
Live Preview: 6-Point Star
Method 1: Using clip-path (Polygon)
.star-6 {
width: 150px;
height: 150px;
background: #cd5454;
/* 12 points (outer/inner) for a 6-point star */
clip-path: polygon(
50% 2%,
62% 29.2%,
91.6% 26%,
74% 50%,
91.6% 74%,
62% 70.8%,
50% 98%,
38% 70.8%,
8.4% 74%,
26% 50%,
8.4% 26%,
38% 29.2%
);
}
/* Optional: center block */
.star-6 {
display: block;
margin-left: auto;
margin-right: auto;
}Method 2: Using Border Triangles (Hexagram)
/* Two overlapping equilateral triangles */
.star-6-hexagram {
position: relative;
width: 0;
height: 0;
border-left: 75px solid transparent;
border-right: 75px solid transparent;
border-bottom: 130px solid #cd5454;
display: block;
margin-left: auto;
margin-right: auto;
}
.star-6-hexagram::after {
content: "";
position: absolute;
left: -75px;
top: 26px; /* adjust overlap */
width: 0;
height: 0;
border-left: 75px solid transparent;
border-right: 75px solid transparent;
border-top: 130px solid #cd5454;
}How This Works
The clip-path method draws a 12-vertex polygon that alternates between outer and inner radii, producing a symmetric 6-point star from a single, content-friendly box. You can tweak the star’s sharpness by changing the inner points (e.g., moving 29.2% closer/farther from the center).
The border-triangle method stacks two CSS triangles (one pointing up, one down) using transparent side borders to form a hexagram. It’s very lightweight but creates no true rectangular box for content, since each triangle has zero intrinsic width/height.
How to Center Content Inside a 6-Point Star
The easiest way is to use Flexbox or Grid on the star element (works best with the clip-path method, which preserves an actual box for layout).
Method 1: Use CSS Flexbox
.star-6 {
display: flex;
justify-content: center;
align-items: center;
color: #fff; /* optional text color */
font: 600 14px/1.2 system-ui, sans-serif;
}Method 2: Use CSS Grid
.star-6 {
display: grid;
place-items: center;
color: #fff; /* optional text color */
font: 600 14px/1.2 system-ui, sans-serif;
}When to Use Each Shape Method
Use clip-path when you need a single, responsive element that can hold centered text or icons and adapt to different sizes. Choose the border-triangle hexagram when you want a super-light decorative shape and don’t need to place content inside the star.
Quick Customizations
Change the fill by updating background: #cd5454; to any color or gradient; add a soft shadow with filter: drop-shadow(0 2px 6px rgba(0,0,0,.2)); or make points sharper/softer by adjusting the inner polygon coordinates.
Accessibility & SEO
If the star conveys meaning, provide a descriptive aria-label (e.g., aria-label=”Featured badge, 6-point star”) and ensure sufficient color contrast for any text inside.