SolutionsCase StudiesAI ToolsResourcesAboutContact
Get Your Free AI Automation Audit Book a Free 30-Minute Strategy Call
Playground~/frontend Open editor

~/css/diagonal-sections

7 CSS Diagonal Sections

7 Pure CSSPublished 2026-10-05Free · no sign-up

Seven ways to break the horizontal line: a slanted bottom edge cut with clip-path, a skewed band whose text stays level, a section sloped on both edges, a diagonal gradient split, a stripe across the background, an image with an angled edge and a chevron that points to the next section.

01. Slanted Bottom Edge with clip-path

DiagonalClip-path

The section's bottom edge slopes because clip-path: polygon() cuts a triangle off it. The cut is a calc() from the bottom so the slope stays the same height at any width, and extra bottom padding keeps the text clear of it.

View code
<section class="dg1"><h3>Designed in Copenhagen</h3><p>Furniture for small apartments.</p></section>
.dg1 { width: 520px; max-width: 100%; box-sizing: border-box; padding: 28px 20px 60px; background: #0f766e; color: #ccfbf1; font: 14px Inter, system-ui, sans-serif; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 40px), 0 100%); }
.dg1 h3 { margin: 0 0 4px; color: #fff; font-size: 22px; } .dg1 p { margin: 0; }

02. Skewed Band with Straight Content

DiagonalTransform

The band is skewed with transform: skewY(-4deg) and its content is skewed back by the same amount, so the edges slope but the text stays level. The skew affects both edges equally, giving a parallel slanted stripe.

View code
<section class="dg2"><div class="in"><h3>Free returns, always</h3><p>Send it back within 30 days.</p></div></section>
.dg2 { width: 520px; max-width: 100%; margin: 20px 0; background: #facc15; transform: skewY(-4deg); font: 14px Inter, system-ui, sans-serif; }
.dg2 .in { padding: 30px 20px; transform: skewY(4deg); color: #422006; text-align: center; }
.dg2 h3 { margin: 0 0 4px; font-size: 22px; } .dg2 p { margin: 0; }

03. Diagonal Top and Bottom

DiagonalSection

A section sloped on both edges in opposite directions, using one four-point polygon. The padding on both sides is larger than the slope height, a rule worth keeping so headings and buttons never get clipped.

View code
<section class="dg3"><h3>Trusted by 2,000 shops</h3><a href="#stories">Read their stories</a></section>
.dg3 { display: grid; justify-items: center; gap: 12px; width: 520px; max-width: 100%; box-sizing: border-box; padding: 54px 20px; background: #312e81; text-align: center; font: 14px Inter, system-ui, sans-serif; clip-path: polygon(0 30px, 100% 0, 100% calc(100% - 30px), 0 100%); }
.dg3 h3 { margin: 0; color: #fff; font-size: 22px; }
.dg3 a { padding: 9px 14px; border-radius: 8px; background: #fff; color: #312e81; font-weight: 700; text-decoration: none; }
.dg3 a:focus-visible { outline: 3px solid #a5b4fc; outline-offset: 2px; }

04. Diagonal Gradient Split

DiagonalGradient

A hard diagonal edge between two colours made entirely with a linear-gradient: two colour stops at the same position create a sharp line instead of a blend. No clipping or extra elements, and the angle is one number.

View code
<section class="dg4"><h3>Day and night</h3><p>Two themes, one switch.</p></section>
.dg4 { width: 520px; max-width: 100%; box-sizing: border-box; padding: 40px 20px; border-radius: 16px; background: linear-gradient(115deg, #f8fafc 0 50%, #0f172a 50% 100%); font: 14px Inter, system-ui, sans-serif; }
.dg4 h3 { margin: 0 0 4px; color: #0f172a; font-size: 24px; }
.dg4 p { display: inline-block; margin: 0; padding: 4px 8px; border-radius: 6px; background: #0f172a; color: #f8fafc; }

05. Diagonal Accent Stripe

DiagonalAccent

A thin coloured stripe crosses the section at an angle behind the heading, an energetic accent for sports or event sites. The stripe is a rotated pseudo-element, wider than the section so its ends are always hidden by overflow.

View code
<section class="dg5"><h3>Race day: 12 April</h3><p>Registration closes on 1 April.</p></section>
.dg5 { position: relative; isolation: isolate; overflow: hidden; width: 520px; max-width: 100%; box-sizing: border-box; padding: 34px 20px; border-radius: 16px; background: #fff7ed; font: 14px Inter, system-ui, sans-serif; }
.dg5::before { content: ""; position: absolute; left: -20%; right: -20%; top: 45%; height: 34px; background: #fb923c; transform: rotate(-8deg); z-index: -1; }
.dg5 h3 { margin: 0 0 6px; color: #431407; font-size: 24px; } .dg5 p { margin: 0; color: #7c2d12; }

06. Angled Image Edge

DiagonalImage

A text and image section where the image's inner edge is angled, so the two halves interlock instead of meeting at a straight line. The clip is on the image only, and the text keeps a normal box.

View code
<section class="dg6"><div class="tx"><h3>Cold brew, done right</h3><p>Steeped for 18 hours.</p></div><div class="im" role="img" aria-label="Iced coffee in a glass"></div></section>
.dg6 { display: grid; grid-template-columns: 1fr 1fr; width: 520px; max-width: 100%; border-radius: 16px; overflow: hidden; background: #1c1917; font: 14px Inter, system-ui, sans-serif; }
.dg6 .tx { align-self: center; padding: 20px; } .dg6 h3 { margin: 0 0 4px; color: #fafaf9; font-size: 20px; } .dg6 p { margin: 0; color: #a8a29e; }
.dg6 .im { min-height: 200px; background: linear-gradient(#e7e5e4 0 20%, #78350f 20% 85%, #e7e5e4 85%); clip-path: polygon(25% 0, 100% 0, 100% 100%, 0 100%); }

07. Chevron Bottom Edge

DiagonalChevron

A section whose bottom edge points down to the next section like an arrow, nudging the reader to scroll. It is a five-point polygon: the centre point drops lower than the two corners.

View code
<section class="dg7"><h3>How it works</h3><p>Three steps, ten minutes.</p></section>
.dg7 { width: 520px; max-width: 100%; box-sizing: border-box; padding: 28px 20px 70px; background: #1d4ed8; color: #dbeafe; text-align: center; font: 14px Inter, system-ui, sans-serif; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 40px), 50% 100%, 0 calc(100% - 40px)); }
.dg7 h3 { margin: 0 0 4px; color: #fff; font-size: 22px; } .dg7 p { margin: 0; }

About these CSS Diagonal Sections

clip-path for edges

clip-path: polygon() trims a section to any shape. Using calc(100% - 40px) for the sloped corner keeps the slope the same height whatever the section's width.

Skew and unskew

transform: skewY(-4deg) slants a whole band, edges included. Skew the inner content back by the same amount so text and buttons stay level.

Leave room for the slope

Clipped corners can cut into content. Add padding larger than the slope height on every sloped edge so nothing important is hidden.

Gradients for hard edges

Two colour stops at the same position in a linear gradient make a crisp line instead of a blend, which draws a diagonal split with no extra elements.

Frequently asked questions

Do clipped sections affect clicks?

Yes. Clipped areas cannot be clicked, which is usually what you want for decoration.

How do I make the next section meet the slope?

Give the next section a negative top margin equal to the slope, or match its background colour behind the cut.

Will diagonals work on phones?

Yes, but use smaller slope heights so they do not eat the small screen.