Last active
December 25, 2015 19:49
-
-
Save micahgodbolt/7030139 to your computer and use it in GitHub Desktop.
Sass Bites #11 Code
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 class="box"> | |
<div class="arrow"></div> | |
</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
@import "compass"; | |
.box { | |
height: 200px; | |
width: 200px; | |
background: black; | |
position: relative; | |
} | |
.arrow { | |
background: black; | |
position: absolute; | |
bottom: -15px; | |
left: 50%; | |
@include translateX(-50%); | |
height: 15px; | |
width: 40px; | |
&:before, &:after { | |
content: ""; | |
background: white; | |
width: 35px; | |
height: 35px; | |
border-radius: 100%; | |
position: absolute; | |
top: 0; | |
} | |
&:before { | |
left: 50%; | |
} | |
&:after { | |
right: 50%; | |
} | |
} |
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
@import "compass"; | |
@mixin rounded-arrow ($background, $height, $width) { | |
background: $background; | |
position: absolute; | |
bottom: -$height; | |
left: 50%; | |
@include translateX(-50%); | |
height: $height; | |
width: $width; | |
&:before, &:after { | |
content: ""; | |
background: white; | |
width: $width * 1.1; | |
height: $height * 2; | |
border-radius: 100%; | |
position: absolute; | |
top: 0; | |
} | |
&:before { | |
left: 50%; | |
} | |
&:after { | |
right: 50%; | |
} | |
} | |
.box { | |
height: 200px; | |
width: 200px; | |
background: black; | |
position: relative; | |
} | |
.arrow { | |
@include rounded-arrow(black, 20px, 60px); | |
} |
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
@import "compass"; | |
@mixin rounded-arrow ($background, $height, $width, $direction:down) { | |
background: $background; | |
position: absolute; | |
@if $direction == 'down' { | |
bottom: -$height; | |
left: 50%; | |
@include translateX(-50%); | |
} | |
@else if $direction == 'right' { | |
right: -$width; | |
top: 50%; | |
@include translateY(-50%); | |
} | |
height: $height; | |
width: $width; | |
&:before, &:after { | |
content: ""; | |
background: white; | |
@if $direction == 'down'{ | |
width: $width * 1.1; | |
height: $height * 2; | |
} | |
@if $direction == 'right'{ | |
width: $width * 2; | |
height: $height * 1.1; | |
} | |
border-radius: 100%; | |
position: absolute; | |
@if $direction == 'down'{ | |
top: 0; | |
} | |
@if $direction == 'right'{ | |
right: -100%; | |
} | |
} | |
@if $direction == 'down' { | |
&:before { | |
left: 50%; | |
} | |
&:after { | |
right: 50%; | |
} | |
} | |
@if $direction == 'right' { | |
&:before { | |
top: 50%; | |
} | |
&:after { | |
bottom: 50%; | |
} | |
} | |
} | |
.box { | |
height: 200px; | |
width: 200px; | |
margin-left: 50px; | |
background: black; | |
position: relative; | |
} | |
.arrow { | |
@include rounded-arrow(black, 60px, 60px, left); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment