Skip to content

Instantly share code, notes, and snippets.

@micahgodbolt
Last active December 25, 2015 19:49
Show Gist options
  • Save micahgodbolt/7030139 to your computer and use it in GitHub Desktop.
Save micahgodbolt/7030139 to your computer and use it in GitHub Desktop.
Sass Bites #11 Code
<div class="box">
<div class="arrow"></div>
</div>
@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%;
}
}
@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);
}
@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