Created
January 23, 2014 17:58
-
-
Save sorahn/8583536 to your computer and use it in GitHub Desktop.
css gradient for triangle shaped arrow (SO)
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 gradient for triangle shaped arrow (SO) | |
* http://stackoverflow.com/q/12431596/1397351 | |
*/ | |
.shape { | |
float: left; | |
position: relative; | |
border: 1px solid #ccc; | |
border-right: none; | |
width: 240px; height: 80px; | |
background: linear-gradient(white, #f1f1f1 37%, #e1e1e1 57%, #f6f6f6); | |
cursor: pointer; | |
} | |
.shape:after { | |
position: absolute; | |
top: 50%; right: -29px; /* this number looks god, but I'd love to be able to get it programatically with SCSS/LESS */ | |
border-top: solid 1px #ccc; | |
border-right: solid 1px #ccc; | |
width: 56.56px; height: 56.56px; /* (sqrt(2)/) * 80 */ | |
transform: scaleX(0.6) translateY(-50%) rotate(45deg); /* create a rhombus */ | |
background: linear-gradient(-45deg, #f6f6f6, #e1e1e1 43%, #f1f1f1 63%, white); | |
content: '' | |
} |
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> --> | |
<div class='shape'></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
// alert('Hello world!'); |
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":"80","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment