Skip to content

Instantly share code, notes, and snippets.

@benweiser
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save benweiser/ac17eea147b9bfc2fbf2 to your computer and use it in GitHub Desktop.

Select an option

Save benweiser/ac17eea147b9bfc2fbf2 to your computer and use it in GitHub Desktop.
CSS Triangles
div {
position:relative; /* Position must be relative to absolutely position :after */
background:#333; /* Background color to show effect */
}
div:after{
content:''; /* Required to display content */
position: absolute; /* Sets the position absolute to the top div */
top: 0;
left: 50%;
margin-left: -50px; /* Set margin equal to border px */
width: 0;
z-index:1;
height: 0;
border-top: solid 50px #fff; /* Creates the notch */
border-left: solid 50px transparent; /* Creates triangle effect */
border-right: solid 50px transparent; /* Creates triangle effect */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment