<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl" -->

---
title: Random Zig-Zag Dividers | daily.dev
description: This CSS tip creates a randomized zig-zag divider shape using the random() function. The clip-path polygon uses a --n variable set to 13 points and a --d...
canonical: https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Random Zig-Zag Dividers | daily.dev
og:description: This CSS tip creates a randomized zig-zag divider shape using the random() function. The clip-path polygon uses a --n variable set to 13 points and a --d...
og:url: https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl
og:image: https://api.daily.dev/og/posts/NLuwO59FL.png
og:image:alt: Random Zig-Zag Dividers
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Random Zig-Zag Dividers

**[CSS Tip](https://daily.dev/sources/csstip)** · 5 min read · 1 upvotes · 0 comments

## Summary

This CSS tip creates a randomized zig-zag divider shape using the random() function. The clip-path polygon uses a --n variable set to 13 points and a --d variable of 80px to control the zig-zag depth. Two random() calls, --_r1 and --_r2, generate varying heights between 0px and 40px and between 40px and 80px so each zig-zag point differs. The same technique flips to put the zig-zag on the top edge instead of the bottom. Until better support, a static version is available through an online generator at css-generators.com/zig-zag-divider.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://css-tip.com/zig-zag-divider>

## Questions this post answers

### How do I create a zig-zag divider shape in CSS using the random() function?

Use clip-path with a polygon where the y-coordinates are generated by random(). Define --n (number of zig-zag points, e.g. 13) and --d (zig-zag depth, e.g. 80px), then create two custom properties --_r1 and --_r2 using random(0px, var(--d)/2) and random(var(--d)/2, var(--d)) to vary each point's height along the x-axis divisions of 50%/var(--n).

_Developers testing cutting-edge CSS features like random() can track browser support updates on daily.dev._

### What can I use instead of CSS random() for a zig-zag divider if the browser doesn't support it yet?

A static, pre-generated version of the zig-zag divider is available through an online generator at css-generators.com/zig-zag-divider, which produces the shape without relying on the random() function, useful until browser support improves.

_Anyone building fallback-safe CSS effects can find more modern CSS techniques on daily.dev._

## Similar posts on daily.dev

- [Random Wavy Dividers](https://daily.dev/posts/random-wavy-dividers-nezirgdbl) · CSS Tip · 3 upvotes · 1 comments
- [A Generator for Random Wavy Dividers](https://daily.dev/posts/a-generator-for-random-wavy-dividers-12hbxgydl) · CSS Tip · 5 upvotes · 0 comments
- [Making Zigzag CSS Layouts With a Grid \+ Transform Trick](https://daily.dev/posts/making-zigzag-css-layouts-with-a-grid-transform-trick-ruh1wrwwv) · CSS-Tricks · 5 upvotes · 0 comments
- [Randomly Place an Element Along Edge of Another Element – Master.dev Blog](https://daily.dev/posts/randomly-place-an-element-along-edge-of-another-element-master-dev-blog-s8zowbf9a) · Frontend Masters · 3 upvotes · 0 comments
- [Folded corner with CSS](https://daily.dev/posts/folded-corner-with-css-nubcaac2w) · Kitty says hi. · 5 upvotes · 0 comments

---

Tags: [#css](https://daily.dev/tags/css)

[View this post on daily.dev](https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Random Zig-Zag Dividers","url":"https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl"},"datePublished":"2026-11-17T10:51:08.506Z","dateModified":"2026-11-17T10:51:32.488Z","description":"This CSS tip creates a randomized zig-zag divider shape using the random() function. The clip-path polygon uses a --n variable set to 13 points and a --d...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6e7954d4fd68e8a184026c0b261b58da?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/6e7954d4fd68e8a184026c0b261b58da?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"CSS Tip","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"CSS Tip","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5d335233e7894c2ea997aa89e1724200","url":"https://daily.dev/sources/csstip"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"css","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CSS Tip","item":"https://daily.dev/sources/csstip"},{"@type":"ListItem","position":3,"name":"Random Zig-Zag Dividers"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/random-zig-zag-dividers-nluwo59fl#faq","mainEntity":[{"@type":"Question","name":"How do I create a zig-zag divider shape in CSS using the random() function?","acceptedAnswer":{"@type":"Answer","text":"Use clip-path with a polygon where the y-coordinates are generated by random(). Define --n (number of zig-zag points, e.g. 13) and --d (zig-zag depth, e.g. 80px), then create two custom properties --_r1 and --_r2 using random(0px, var(--d)/2) and random(var(--d)/2, var(--d)) to vary each point's height along the x-axis divisions of 50%/var(--n). Developers testing cutting-edge CSS features like random() can track browser support updates on daily.dev."}},{"@type":"Question","name":"What can I use instead of CSS random() for a zig-zag divider if the browser doesn't support it yet?","acceptedAnswer":{"@type":"Answer","text":"A static, pre-generated version of the zig-zag divider is available through an online generator at css-generators.com/zig-zag-divider, which produces the shape without relying on the random() function, useful until browser support improves. Anyone building fallback-safe CSS effects can find more modern CSS techniques on daily.dev."}}]}
```

