Skip to content

Instantly share code, notes, and snippets.

@rolandcoops
Last active December 10, 2018 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolandcoops/21f14bc103500b4cededb989c349e895 to your computer and use it in GitHub Desktop.
Save rolandcoops/21f14bc103500b4cededb989c349e895 to your computer and use it in GitHub Desktop.
Speech arrow mixin
@mixin with-speech-arrow (
$align: left,
$size: 20px,
$border-color: #eee
) {
&:before,
&:after {
content: '';
position: absolute;
border-color: transparent;
border-style: solid;
border-top: 0;
}
// speech arrow border (actually the bottom of two fill-shapes)
&:before {
top: -$size;
#{$align}: $size;
border-width: $size;
border-bottom-color: $border-color;
}
// speech arrow fill (rendered on top of the ‘border’ fill-shape)
&:after {
top: -$size + 1px;
#{$align}: $size + 1px;
border-width: $size - 1px;
border-bottom-color: $white; // should clip main shape’s border with that shape’s background colour…
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment