-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path_text.scss
163 lines (144 loc) · 4.89 KB
/
_text.scss
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/* @author Bilal Cinarli */
/** -------------------------------------------
Text Related Mixins
------------------------------------------- **/
/**
* Fontface
*
* http://caniuse.com/#search=font-face
* https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face
* For modern approach, woff and ttf format is supported all major browsers. If you need to support
* Internet Explorer 8, with setting "$support-for-ie8" variable to "true", the eot file format
* also added to mixin output. You also need to provide related file formats in your fonts folder.
*
* @font-face {
[ font-family: <family-name>; ]?
|| [ src: [ <uri> [format(<string>#)]? | <font-face-name> ]#; ]?
|| [ unicode-range: <urange>#; ]?
|| [ font-variant: <font-variant>; ]?
|| [ font-feature-settings: normal|<feature-tag-value>#; ]?
|| [ font-stretch: <font-stretch>; ]?
|| [ font-weight: <weight>; ]?
|| [ font-style: <style>; ]?
}
*/
@mixin font-face($name, $file, $weight: normal, $style: normal) {
$ie8-support: false;
$woff2-support: false;
$eot: "";
$woff2: "";
@if variable_exists(support-for-ie8) {
$ie8-support: $support-for-ie8;
}
@if variable_exists(support-for-woff2){
$woff2-support: $support-for-woff2;
}
@if ($ie8-support == true) {
$eot: 'url("../fonts/#{$file}.eot?#caffeine") format("embedded-opentype"),'
}
@if ($woff2-support == true){
$woff2: 'url("../fonts/#{$file}.woff2?#caffeine") format("woff2"),'
}
@font-face {
font-family: "#{$name}";
src: #{$eot}
#{$woff2}
url("../fonts/#{$file}.woff?caffeine") format("woff"),
url("../fonts/#{$file}.ttf?caffeine") format("truetype");
font-weight: $weight;
font-style: $style;
}
}
/**
* fontface
* This mixin is a callback support for very early versions of Caffeine
*/
@mixin fontface($name, $file, $weight: normal, $style: normal) {
@include font-face($name, $file, $weight, $style);
@warn "fontface mixin is going to be depreciated in newer versions. Please you font-face mixin instead";
}
/**
* Font Icon
*
* Outputs an icon font definition with supporting class attribute selectors.
* For preventing font misuse for the element, the class selector applied to :before pseuode element
* instead of the element itself.
*/
@mixin font-icon($name, $file) {
$prefix-icon: 'icon-';
$placeholder-icon: '%font-icon';
@if variable_exists(icon-prefix) {
$prefix-icon: $icon-prefix;
}
@if variable_exists(icon-placeholder) {
$placeholder-icon: $icon-placeholder;
}
@include font-face($name, $file);
#{$placeholder-icon} {
font: {
family: $name;
style: normal;
variant: normal;
weight: normal;
}
;
line-height: 1;
text-transform: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
[class^="#{$prefix-icon}"]:before, [class*=" #{$prefix-icon}"]:before {
@extend #{$placeholder-icon};
}
}
/**
* Font-Size callback
*
* For modern usage, converts and output font-size with rem units.
*/
@mixin font-size($font-size) {
$ie8-support: true;
@if variable_exists(support-for-ie8) {
$ie8-support: $support-for-ie8;
}
@if ($font-size == inherit) {
font-size: inherit;
} @else {
@if ($ie8-support == true) {
font-size: rem-to-px($font-size);
}
font-size: rem($font-size);
}
}
/**
* Disable Select
* It is useful for mobil applications
* Prevents text selection when swipe or double click
* http://caniuse.com/#search=user-select
* https://developer.mozilla.org/en-US/docs/Web/CSS/user-select
* Formal syntax: none | text | all | element
* Current spec, all vendors need prefixing
*/
@mixin disable-text-select() {
@include prefixer('user-select', none, webkit moz ms);
}
/**
* Selection
*
* The ::selection CSS pseudo-element applies rules to the portion of a document
* that has been highlighted (e.g., selected with the mouse or another pointing device) by the user.
* http://caniuse.com/#search=selection
* https://developer.mozilla.org/en-US/docs/Web/CSS/::selection
* Formal syntax: content
* Only a small part of text related properties supports. You can change the following properties in selectionsİ
* color, background-color, cursor, outline, text-decoration, text-emphasis-color and text-shadow.
*
* Notes:
* text-shadow in ::selection is supported by Chrome, Safari and Firefox 17+.
*
* The ::selection CSS pseudo-element was drafted for CSS Selectors Level 3
* but removed before it reached the Recommendation status. It was readded as part of the Pseudo-Elements Level 4 draft.
*/
@mixin selection($content...) {
@include prefixer(selection, $content, moz);
}