CSS Diagonal Split Screen

A two-sided hero cut by a diagonal line with clip-path, each side holding its own message and link.

  • split screen
  • clip-path
  • diagonal
  • hero
  • two audiences
HTML
<section class="diag-split">
  <div class="diag-split-a">
    <h2>For buyers</h2>
    <a href="#">Shop now</a>
  </div>
  <div class="diag-split-b">
    <h2>For sellers</h2>
    <a href="#">Start selling</a>
  </div>
</section>
CSS
.diag-split {
  display: grid;
  min-height: 60vh;
  font: 15px/1.3 system-ui, sans-serif;
}

/* Both halves share one grid cell; the second is cut diagonally */
.diag-split > * {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 40px;
}

.diag-split h2 {
  margin: 0;
  font-size: 28px;
}

.diag-split a {
  color: inherit;
  font-weight: 700;
}

.diag-split a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.diag-split-a {
  align-items: flex-start;
  padding-right: 55%;
  background: #fef3c7;
  color: #78350f;
}

.diag-split-b {
  align-items: flex-end;
  padding-left: 55%;
  background: #1e1b4b;
  color: #e0e7ff;
  text-align: right;
  clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
}

/* Phones: stack, with a slanted top edge on the second half */
@media (max-width: 560px) {
  .diag-split > * {
    grid-area: auto;
    padding: 32px 24px;
  }

  .diag-split-b {
    margin-top: -24px;
    clip-path: polygon(0 24px, 100% 0, 100% 100%, 0 100%);
  }
}

About this CSS Diagonal Split Screen

This CSS Diagonal Split Screen is 59 lines of pure CSS (1.0 KB) with no JavaScript and no dependencies. It uses clip paths, CSS Grid, Flexbox and keyboard focus styles. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.

CSS features used

Customize it

The colors in this snippet. Search and replace them to match your brand:

  • #fef3c7
  • #78350f
  • #1e1b4b
  • #e0e7ff

How to use this diagonal split screen

  1. Copy the HTML and paste it where you want the element to appear.
  2. Copy the CSS into your stylesheet, or inside a <style> tag.
  3. Keep the .diag-split class name, or rename it in both places. Then tweak colors, sizes and timing to match your design.
  4. Using React or Next.js? Change class to className in the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).

Building with an AI tool?

“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.

Feedback