Skip to content

Instantly share code, notes, and snippets.

View kovtunos's full-sized avatar

Andrey Kovtun kovtunos

View GitHub Profile
@kovtunos
kovtunos / _buttons.scss
Last active July 23, 2016 04:20
Button generator #mixin
// Button generator.
//
// Usage:
// @include button-variant(TEXT COLOR, BACKGROUND COLOR, BORDER COLOR);
// @include button-variant(TEXT COLOR, BACKGROUND COLOR);
%btn {
margin: 0 .5em;
transition: background-color ease .2s;
}
@kovtunos
kovtunos / _borders.scss
Created July 19, 2016 12:10
Dotted underline border #mixin
// Dotted underline border.
// https://jsfiddle.net/xandeadx/n16294kk/1/
//
// Usage:
// @include dotted-border;
// @include dotted-border(#bebebe, 3px);
// @include dotted-border(#bebebe, 1px, 3px);
@mixin dotted-border($color: #000, $dot-width: 1px, $separator-width: 1px) {
background-image: linear-gradient(to right, $color $dot-width, transparent $dot-width);
background-position: 0 bottom;
@kovtunos
kovtunos / _banners.scss
Last active July 23, 2016 17:23
Full width banner #mixin
// Full width image banner.
//
// Usage:
// @include banner('../images/banner.jpg')
// @include banner('../images/banner.jpg', 700px)
// @include banner('../images/banner.jpg', 700px, center, center, #fff)
// @include banner('../images/banner.jpg', 700px, center, center, #fff, true)
// @include banner('../images/banner.jpg', 700px, center, center, #fff, false, rgba(255, 0, 0, .45))
@mixin banner($url, $height: 600px, $horizontal: center, $vertical: center, $fallback-color: null, $paralax: null, $overlay: null) {
@if($overlay) {
@kovtunos
kovtunos / _centered.scss
Created July 19, 2016 12:31
Center element #mixin
// Center element.
// https://css-tricks.com/snippets/sass/centering-mixin/
//
// Usage:
// Arguments: horizontal, vertical
// Note: parent div should be in relative position.
//
// @include centered();
// @include centered(true, false);
// @include centered(false, true);
@kovtunos
kovtunos / _image_circle.scss
Created July 19, 2016 12:32
Image circle #mixin
// Image circle.
//
// Usage:
// @include image-circle(125px)
// @include image-circle(125px, 5px, #bebebe)
@mixin image-circle($width, $border-width: null, $border-color: null) {
margin: 0 auto;
width: $width;
img {
@kovtunos
kovtunos / _fonts.scss
Created July 19, 2016 12:33
Iconic font mapping #mixin
// Iconic font mapping.
//
// Usage:
// @include icon(a);
// @include icon(b);
@mixin icon($letter) {
.icon {
&.icon-#{$letter}::before {
content: '#{$letter}';
}
@kovtunos
kovtunos / _font-size.scss
Created July 19, 2016 12:36
Font size calculation #mixin
// Font size calculation.
@mixin font-size($size, $compute-line-height: false) {
font-size: #{strip-unit($size)}px;
font-size: rem($size);
@if $compute-line-height == true {
line-height: #{floor($line-height-base * $size)}px;
}
}
@kovtunos
kovtunos / _clearfix.scss
Created July 19, 2016 12:49
Clearfix #mixin
// Clearfix.
// Works in IE6 and up.
// http://zerosixthree.se/8-sass-mixins-you-must-have-in-your-toolbox/
//
// Usage: @extend %clearfix;
%clearfix {
*zoom: 1;
&:before, &:after {
content: " ";
display: table;
@kovtunos
kovtunos / _underline.scss
Last active July 28, 2016 07:36
Configurable underline border #sass
a {
color: #fff;
position: relative;
text-decoration: none;
&:hover {
&::after {
border: 1px solid #fff;
bottom: -5px;
content: '';
@kovtunos
kovtunos / li_arrow_bourbon.scss
Last active July 28, 2016 07:38
List (li) triangle using bourbon mixin #sass
li {
position: relative;
&::before {
@include triangle(12px, #fff, right);
content: '';
display: block;
width: 6px;
height: 10px;
position: absolute;