Skip to content

Instantly share code, notes, and snippets.

@Grawl
Created December 16, 2011 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grawl/1484524 to your computer and use it in GitHub Desktop.
Save Grawl/1484524 to your computer and use it in GitHub Desktop.
CSS triangle with border
/**
* CSS triangle with border
*/
body {
padding: 10px 30px;
}
div {
background: white;
border: 1px solid #666666;
padding: 10px;
margin: 10px 0 0;
width: 200px;
position: relative;
text-align: center;
}
div::before {
content: "";
display: block;
position: absolute;
left: 50%;
top: -6px;
margin-left: -5px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
background: white;
border: inherit;
width: 10px;
height: 10px;
}
div::after {
content: "";
display: block;
position: absolute;
left: 50%;
top: 0;
background: white;
width: 20px;
height: 10px;
margin-left: -10px;
}
<div>GrawlCore</div>
{"page":"css","view":"split-vertical"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment