Skip to content

Instantly share code, notes, and snippets.

@madebyaleks
Last active June 28, 2018 12:28
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 madebyaleks/8446664 to your computer and use it in GitHub Desktop.
Save madebyaleks/8446664 to your computer and use it in GitHub Desktop.
Makes 'a.<service name>' classes from predefined variables. This class adds a 1px border (with the colour matching the service) below the element, and also changes the text colour and makes the border transparent on hover.Note: This code is based on a example I am unable to locate.
//Base colour. Used when hovering a link.
$base: #242322;
//Colours variables (from brandcolors.net)
$facebook: #3b5998;
$twitter: #00acee;
$linkedin: #0e76a8;
$instagram: #3f729b;
$dribbble: #ea4c89;
$github: #171515;
$class_names: facebook, twitter, linkedin, instagram, dribbble, github;
$social_colours: $facebook, $twitter, $linkedin, $instagram, $dribbble, $github;
@for $i from 1 through length($class_names) {
$this-colour: nth($social_colours, $i);
a.#{nth($class_names, $i)} {
border-bottom: 1px solid $this-colour;
color: $base;
text-decoration: none;
&:hover {
border-bottom: 1px solid transparent;
color: $this-colour;
text-decoration: inherit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment