Last active
August 29, 2015 13:57
-
-
Save pcalves/9813007 to your computer and use it in GitHub Desktop.
CSS Triangle border
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
/** | |
* CSS Triangle border | |
*/ | |
body { | |
background-color: #e6e6da; | |
color: black; | |
font-family: sans-serif; | |
font-size: 14px; | |
} | |
.stack__item { | |
color: white; | |
box-sizing: border-box; | |
display: inline-block; | |
width:100px; | |
height:50px; | |
padding: 15px 0 15px 20px; | |
position: relative; | |
background-color: #990000; | |
margin-right:30px; | |
} | |
.stack__item:before { | |
content: ""; | |
position: absolute; | |
top:0; | |
right:-30px; | |
border-top: 25px solid #990000; | |
border-bottom: 25px solid #990000; | |
border-left: 25px solid transparent; | |
} | |
.stack__item:after { | |
content:""; | |
position: absolute; | |
right: -25px; | |
top: 0; | |
border-top: 25px solid transparent; | |
border-bottom: 25px solid transparent; | |
border-left: 25px solid #990000; | |
} | |
.stack > .stack__item:last-of-type:before { | |
border:0; | |
} |
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
<!-- content to be placed inside <body>…</body> --> | |
<h1>One Element</h1> | |
<div class="stack"> | |
<div class="stack__item">Element #1</div> | |
</div> | |
<h1>Stacked Elements</h1> | |
<div class="stack"> | |
<div class="stack__item">Element #1</div><!-- | |
--><div class="stack__item">Element #2</div><!-- | |
--><div class="stack__item">Element #3</div><!-- | |
--><div class="stack__item">Element #4</div> | |
</div> |
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
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment