Skip to content

Instantly share code, notes, and snippets.

@adamschwartz
Created July 28, 2016 19:15
Show Gist options
  • Save adamschwartz/3c41ab849ae69562f61e611e98ff2caf to your computer and use it in GitHub Desktop.
Save adamschwartz/3c41ab849ae69562f61e611e98ff2caf to your computer and use it in GitHub Desktop.
Angled wedge SVG CSS
<style>
section {
height: 25vh;
background: #fff;
text-align: center;
font-family: Avenir Next, sans-serif;
line-height: 25vh;
font-size: 19px;
}
[red] {
background: red;
color: #fff;
}
wedge {
display: block
}
wedge:after {
content: "";
display: block;
height: 4em;
}
wedge[white-red] {
background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='none' viewBox='0 0 1 1'><path fill='red' d='M1 1 L0 1 L1 0 z'></path></svg>") no-repeat
}
</style>
<section>Text</section>
<wedge white-red></wedge>
<section red>Text</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment