UNPKG

8.49 kBSCSSView Raw
1// Name: Text
2// Description: Utilities for text
3//
4// Component: `uk-text-*`
5//
6// ========================================================================
7
8
9// Variables
10// ========================================================================
11
12$text-lead-font-size: $global-large-font-size !default;
13$text-lead-line-height: 1.5 !default;
14$text-lead-color: $global-emphasis-color !default;
15
16$text-meta-font-size: $global-small-font-size !default;
17$text-meta-line-height: 1.4 !default;
18$text-meta-color: $global-muted-color !default;
19
20$text-small-font-size: $global-small-font-size !default;
21$text-small-line-height: 1.5 !default;
22
23$text-large-font-size: $global-large-font-size !default;
24$text-large-line-height: 1.5 !default;
25
26$text-muted-color: $global-muted-color !default;
27$text-emphasis-color: $global-emphasis-color !default;
28$text-primary-color: $global-primary-background !default;
29$text-secondary-color: $global-secondary-background !default;
30$text-success-color: $global-success-background !default;
31$text-warning-color: $global-warning-background !default;
32$text-danger-color: $global-danger-background !default;
33
34$text-background-color: $global-primary-background !default;
35
36
37/* ========================================================================
38 Component: Text
39 ========================================================================== */
40
41
42/* Style modifiers
43 ========================================================================== */
44
45.uk-text-lead {
46 font-size: $text-lead-font-size;
47 line-height: $text-lead-line-height;
48 color: $text-lead-color;
49 @if(mixin-exists(hook-text-lead)) {@include hook-text-lead();}
50}
51
52.uk-text-meta {
53 font-size: $text-meta-font-size;
54 line-height: $text-meta-line-height;
55 color: $text-meta-color;
56 @if(mixin-exists(hook-text-meta)) {@include hook-text-meta();}
57}
58
59
60/* Size modifiers
61 ========================================================================== */
62
63.uk-text-small {
64 font-size: $text-small-font-size;
65 line-height: $text-small-line-height;
66 @if(mixin-exists(hook-text-small)) {@include hook-text-small();}
67}
68
69.uk-text-large {
70 font-size: $text-large-font-size;
71 line-height: $text-large-line-height;
72 @if(mixin-exists(hook-text-large)) {@include hook-text-large();}
73}
74
75
76/* Weight modifier
77 ========================================================================== */
78
79.uk-text-light { font-weight: 300; }
80.uk-text-normal { font-weight: 400; }
81.uk-text-bold { font-weight: 700; }
82
83.uk-text-lighter { font-weight: lighter; }
84.uk-text-bolder { font-weight: bolder; }
85
86
87/* Style modifier
88 ========================================================================== */
89
90.uk-text-italic { font-style: italic; }
91
92
93/* Transform modifier
94 ========================================================================== */
95
96.uk-text-capitalize { text-transform: capitalize !important; }
97.uk-text-uppercase { text-transform: uppercase !important; }
98.uk-text-lowercase { text-transform: lowercase !important; }
99
100
101/* Color modifiers
102 ========================================================================== */
103
104.uk-text-muted { color: $text-muted-color !important; }
105.uk-text-emphasis { color: $text-emphasis-color !important; }
106.uk-text-primary { color: $text-primary-color !important; }
107.uk-text-secondary { color: $text-secondary-color !important; }
108.uk-text-success { color: $text-success-color !important; }
109.uk-text-warning { color: $text-warning-color !important; }
110.uk-text-danger { color: $text-danger-color !important; }
111
112
113/* Background modifier
114 ========================================================================== */
115
116/*
117 * 1. The background clips to the foreground text. Works in Chrome, Firefox, Safari, Edge and Opera
118 * Default color is set to transparent
119 * 2. Container fits the text
120 * 3. Fallback color for IE11
121 */
122
123.uk-text-background {
124 /* 1 */
125 -webkit-background-clip: text;
126 -webkit-text-fill-color: transparent;
127 /* 2 */
128 display: inline-block;
129 /* 3 */
130 color: $text-background-color !important;
131}
132
133@supports (-webkit-background-clip: text) {
134
135 .uk-text-background {
136 background-color: $text-background-color;
137 @if(mixin-exists(hook-text-background)) {@include hook-text-background();}
138 }
139
140}
141
142
143/* Alignment modifiers
144 ========================================================================== */
145
146.uk-text-left { text-align: left !important; }
147.uk-text-right { text-align: right !important; }
148.uk-text-center { text-align: center !important; }
149.uk-text-justify { text-align: justify !important; }
150
151/* Phone landscape and bigger */
152@media (min-width: $breakpoint-small) {
153
154 .uk-text-left\@s { text-align: left !important; }
155 .uk-text-right\@s { text-align: right !important; }
156 .uk-text-center\@s { text-align: center !important; }
157
158}
159
160/* Tablet landscape and bigger */
161@media (min-width: $breakpoint-medium) {
162
163 .uk-text-left\@m { text-align: left !important; }
164 .uk-text-right\@m { text-align: right !important; }
165 .uk-text-center\@m { text-align: center !important; }
166
167}
168
169/* Desktop and bigger */
170@media (min-width: $breakpoint-large) {
171
172 .uk-text-left\@l { text-align: left !important; }
173 .uk-text-right\@l { text-align: right !important; }
174 .uk-text-center\@l { text-align: center !important; }
175
176}
177
178/* Large screen and bigger */
179@media (min-width: $breakpoint-xlarge) {
180
181 .uk-text-left\@xl { text-align: left !important; }
182 .uk-text-right\@xl { text-align: right !important; }
183 .uk-text-center\@xl { text-align: center !important; }
184
185}
186
187/*
188 * Vertical
189 */
190
191.uk-text-top { vertical-align: top !important; }
192.uk-text-middle { vertical-align: middle !important; }
193.uk-text-bottom { vertical-align: bottom !important; }
194.uk-text-baseline { vertical-align: baseline !important; }
195
196
197/* Wrap modifiers
198 ========================================================================== */
199
200/*
201 * Prevent text from wrapping onto multiple lines
202 */
203
204.uk-text-nowrap { white-space: nowrap; }
205
206/*
207 * 1. Make sure a max-width is set after which truncation can occur
208 * 2. Prevent text from wrapping onto multiple lines, and truncate with an ellipsis
209 * 3. Fix for table cells
210 */
211
212.uk-text-truncate {
213 /* 1 */
214 max-width: 100%;
215 /* 2 */
216 overflow: hidden;
217 text-overflow: ellipsis;
218 white-space: nowrap;
219}
220
221/* 2 */
222th.uk-text-truncate,
223td.uk-text-truncate { max-width: 0; }
224
225
226/*
227 * 1. Wrap long words onto the next line and break them if they are too long to fit
228 * 2. Legacy `word-wrap` as fallback for `overflow-wrap`
229 * 3. Fix `overflow-wrap` which doesn't work with table cells in Chrome, Opera, IE11 and Edge
230 * Must use `break-all` to support IE11 and Edge
231 * Note: Not using `hyphens: auto;` because it hyphenates text even if not needed
232 */
233
234.uk-text-break {
235 /* 1 */
236 overflow-wrap: break-word;
237 /* 2 */
238 word-wrap: break-word;
239}
240
241/* 3 */
242th.uk-text-break,
243td.uk-text-break { word-break: break-all; }
244
245
246
247// Hooks
248// ========================================================================
249
250@if(mixin-exists(hook-text-misc)) {@include hook-text-misc();}
251
252// @mixin hook-text-lead(){}
253// @mixin hook-text-meta(){}
254// @mixin hook-text-small(){}
255// @mixin hook-text-large(){}
256// @mixin hook-text-background(){}
257// @mixin hook-text-misc(){}
258
259
260// Inverse
261// ========================================================================
262
263$inverse-text-lead-color: $inverse-global-color !default;
264$inverse-text-meta-color: $inverse-global-muted-color !default;
265$inverse-text-muted-color: $inverse-global-muted-color !default;
266$inverse-text-emphasis-color: $inverse-global-emphasis-color !default;
267$inverse-text-primary-color: $inverse-global-primary-background !default;
268$inverse-text-secondary-color: $inverse-global-primary-background !default;
269
270
271
272// @mixin hook-inverse-text-lead(){}
273// @mixin hook-inverse-text-meta(){}