Skip to content

Commit 595d53e

Browse files
author
Nick Hess
committed
Add font declarations, rscss examples
1 parent 58d26d2 commit 595d53e

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

README.md

+48-3
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,25 @@ Use `0` instead of `none` to specify that a style has no border.
252252
font-weight: bold;
253253
@include transition(background 0.5s ease);
254254

255-
.icon {
255+
> .icon {
256256
margin-right: 10px;
257257
}
258258
}
259259
```
260260

261+
4. Variants
262+
Nested and prefixed using a dash.
263+
```scss
264+
.btn {
265+
&.-wide {
266+
/* ... */
267+
}
268+
&.-short {
269+
/* ... */
270+
}
271+
}
272+
```
273+
261274
### Variables
262275

263276
Prefer dash-cased variable names (e.g. `$my-variable`) over camelCased or snake_cased variable names. It is acceptable to prefix variable names that are intended to be used only within the same file with an underscore (e.g. `$_my-variable`).
@@ -276,8 +289,8 @@ Mixins should be used to DRY up your code, add clarity, or abstract complexity--
276289

277290
```scss
278291
.page-container {
279-
.content {
280-
.profile {
292+
> .content {
293+
> .profile {
281294
// STOP!
282295
}
283296
}
@@ -296,6 +309,38 @@ If you must use an ID selector in the first place (and you should really try not
296309

297310
**[⬆ back to top](#table-of-contents)**
298311

312+
### Font Declarations & Fallback Fonts
313+
314+
- Use @font-face declarations to define a custom font-family and its properties such as name, location, and style characteristics
315+
- Use font-display property and preload to control font loading behavior and reduce FOIT and FOUT. Font-display is currently not supported on IE, Edge, Opera and Android and preload is not supported on IE, Firefox, Opera and only partially on Edge.
316+
317+
```html
318+
<link rel="preload" href="/fonts/custom.woff2" as="font" type="font/woff2" crossorigin>
319+
```
320+
321+
- Aiming to support modern browsers, we use woff and woff2 formats to offer a practical level of browser support. Woff2 is supported in all browsers except IE11, Opera and Android, default to woff after
322+
323+
```scss
324+
@font-face {
325+
font-family: "Some Custom Font";
326+
font-style: normal;
327+
font-weight: normal;
328+
font-display: auto;
329+
src: local("Some Custom Font"), url("fonts/custom.woff2") format("woff2"), url("fonts/custom.woff")
330+
format("woff");
331+
}
332+
```
333+
334+
- In the case that custom fonts fail to load, use web fonts linked offsite to Google Fonts. Lastly, default to system fonts
335+
336+
```scss
337+
@import url(//fonts.googleapis.com/css?family=Open+Sans);
338+
339+
body {
340+
font-family: "Some Custom Font", "Open Sans", Tahoma;
341+
}
342+
```
343+
299344
## Translation
300345

301346
This style guide is also available in other languages:

0 commit comments

Comments
 (0)