aboutsummaryrefslogtreecommitdiffstats
path: root/demo/src/sass/lib/mixins.scss
blob: cdfcb87d3fb89654edd04f08754d971cec597ab6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// ==========================================================================
// Mixins
// ==========================================================================

// Convert a <button> into an <a>
// ---------------------------------------
@mixin cancel-button-styles() {
    background: transparent;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    font: inherit;
    line-height: $line-height-base;
    margin: 0;
    padding: 0;
    position: relative;
    text-align: inherit;
    text-shadow: inherit;
    -moz-user-select: text; // stylelint-disable-line
    vertical-align: baseline;
    width: auto;
}

// Nicer focus styles
// ---------------------------------------
@mixin tab-focus($color: $tab-focus-default-color) {
    box-shadow: 0 0 0 3px rgba($color, 0.35);
    outline: 0;
}

// Use rems for font sizing
// Leave <body> at 100%/16px
// ---------------------------------------
@function calculate-rem($size) {
    $rem: $size / 16;
    @return #{$rem}rem;
}

@mixin font-size($size: 16) {
    font-size: $size * 1px; // Fallback in px
    font-size: calculate-rem($size);
}

// Font smoothing
// ---------------------------------------
@mixin font-smoothing($enabled: true) {
    @if $enabled {
        -moz-osx-font-smoothing: grayscale;
        -webkit-font-smoothing: antialiased;
    } @else {
        -moz-osx-font-smoothing: auto;
        -webkit-font-smoothing: subpixel-antialiased;
    }
}