Last active
December 10, 2015 23:48
-
-
Save andrewrocco/4512071 to your computer and use it in GitHub Desktop.
Here's a way to create a white diagonal line on a black background using pseudo elements and css triangles. It works on all modern browsers, and IE8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Diagonal Lines | |
.some-element { | |
background: black; | |
position: relative; | |
&:before, | |
&:after { | |
border-top: 40px solid transparent; | |
border-bottom: 40px solid transparent; | |
content: ""; | |
display: block; | |
height: 0; | |
position: absolute; | |
top: -40px; | |
width: 0; | |
} | |
&:before { | |
border-left: 40px solid white; | |
left: 1px; | |
} | |
&:after { | |
border-left: 40px solid black; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment