Skip to content

Instantly share code, notes, and snippets.

@designbyadrian
Last active August 29, 2015 14:07
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 designbyadrian/dc48a6fb0924b8c7e1dc to your computer and use it in GitHub Desktop.
Save designbyadrian/dc48a6fb0924b8c7e1dc to your computer and use it in GitHub Desktop.
SASS Tag mixin
@mixin tag($fcolor,$color,$bcolor)
$border-radius: 0.3
$nohyp: (1.95) * sin(45deg) // 1.95 = height in ems including padding, minus border radius
padding: .4em .6em
border-radius: #{$border-radius}em
background-color: $color
color: $fcolor
z-index: 1
margin-right: #{$nohyp}em
&:before
content: ''
position: absolute
background-color: $bcolor
width: #{$border-radius*1.4}em
height: #{$border-radius*1.4}em
border-radius: #{$border-radius}em
right: -#{$border-radius*1.4}em
top: 50%
margin-top: -#{$border-radius*1.2/2}em
z-index: 2
&:after
content: ''
border-radius: #{$border-radius}em
position: absolute
height: #{$nohyp}em
width: #{$nohyp}em
top: 0
right: -.7em
background-color: $color
z-index: -1
transform-origin: 25%
transform: rotate(45deg)

#Sassy Tag Realistic, flat-design, adaptive, SASSy, tags for your tag lists

##Demo On CodePen

##Requires

##Usage

.myTag
    @include tag(textColour,tagColour,backgroundColour)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment