Last active
August 29, 2015 14:15
-
-
Save dangtienngoc/9f611d13e9a702c1fbe2 to your computer and use it in GitHub Desktop.
Cart Icon
This file contains hidden or 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
| <div id="cart"><span>6</span></div> |
This file contains hidden or 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
| // ---- | |
| // Sass (v3.4.11) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @mixin rotate($degrees) { | |
| -webkit-transform: rotate($degrees); | |
| -ms-transform: rotate($degrees); // IE9 only | |
| -o-transform: rotate($degrees); | |
| transform: rotate($degrees); | |
| } | |
| #cart { | |
| width: 30px; | |
| height: 30px; | |
| position: relative; | |
| margin: 10px auto; | |
| color: black; | |
| text-align: center; | |
| line-height: 30px; | |
| z-index: 2; | |
| cursor: pointer; | |
| span { | |
| position: relative; | |
| z-index: 5; | |
| } | |
| &:before { | |
| position: absolute; | |
| content: ""; | |
| display: block; | |
| top: 0; width: 100%; | |
| left: 0; height: 100%; | |
| border: 1px solid black; | |
| @include rotate(45deg); | |
| z-index: 0; | |
| } | |
| &:hover { | |
| &:before { | |
| border-color: red; | |
| } | |
| } | |
| } |
This file contains hidden or 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
| #cart { | |
| width: 30px; | |
| height: 30px; | |
| position: relative; | |
| margin: 10px auto; | |
| color: black; | |
| text-align: center; | |
| line-height: 30px; | |
| z-index: 2; | |
| cursor: pointer; | |
| } | |
| #cart span { | |
| position: relative; | |
| z-index: 5; | |
| } | |
| #cart:before { | |
| position: absolute; | |
| content: ""; | |
| display: block; | |
| top: 0; | |
| width: 100%; | |
| left: 0; | |
| height: 100%; | |
| border: 1px solid black; | |
| -webkit-transform: rotate(45deg); | |
| -ms-transform: rotate(45deg); | |
| -o-transform: rotate(45deg); | |
| transform: rotate(45deg); | |
| z-index: 0; | |
| } | |
| #cart:hover:before { | |
| border-color: red; | |
| } |
This file contains hidden or 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
| <div id="cart"><span>6</span></div> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Play with this gist on SassMeister.
<script src="http://cdn.sassmeister.com/js/embed.js" async></script>