Skip to content

Commit 02eabea

Browse files
committed
restructure source files
1 parent a7915b4 commit 02eabea

File tree

12 files changed

+292
-315
lines changed

12 files changed

+292
-315
lines changed

src/content-sectioning.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,14 @@ h6 {
1616
font-weight: normal;
1717
line-height: inherit;
1818
}
19+
20+
/**
21+
* Print styles.
22+
*/
23+
24+
@media print {
25+
h2,
26+
h3 {
27+
page-break-after: avoid;
28+
}
29+
}

src/forms.css

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Indicates that a label will shift focus to its associated control.
3+
*/
4+
5+
label[for] {
6+
cursor: pointer;
7+
}
8+
19
/*
210
* Override normalize.css's opinionated styles, `line-height` is set to 'normal'
311
* as that's what most user-agents use. See:
@@ -45,8 +53,8 @@ button:disabled {
4553
}
4654

4755
/*
48-
* 1. Remove top inner shadow that iOS applies to all textual inputs. ✌︎ Credit
49-
* https://davidwalsh.name/input-shadows-ipad
56+
* 1. Remove top inner shadow that iOS applies to all textual inputs.
57+
* ✌︎ Credit https://davidwalsh.name/input-shadows-ipad
5058
* 2. Remove padding (mostly 1px) that most user-agents apply to all textual
5159
* inputs.
5260
*/
@@ -67,6 +75,27 @@ button:disabled {
6775
padding: 0; /* 2 */
6876
}
6977

78+
/**
79+
* Set OpenType features for specific input types, mostly numeric. Remove
80+
* kerning and proportional, oldstyle numerals. Enable lining numerals.
81+
*
82+
* NOTE: See the "OpenType features" section in the README.md.
83+
*/
84+
85+
[type='color'],
86+
[type='date'],
87+
[type='datetime-local'],
88+
[type='month'],
89+
[type='number'],
90+
[type='range'],
91+
[type='tel'],
92+
[type='time'],
93+
[type='week'] {
94+
font-feature-settings: 'kern' 0, 'onum' 0, 'lnum';
95+
font-kerning: none;
96+
font-variant-numeric: lining-nums;
97+
}
98+
7099
/*
71100
* Disable horizontal resizing.
72101
*/
Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1-
/**
2-
* Indicates that a label will shift focus to its associated control.
1+
/*
2+
* Remove margins, paddings, and borders from all elements except `<input>` so
3+
* that everything is on an even playing field.
4+
*/
5+
6+
*:not(input) {
7+
border: 0;
8+
margin: 0;
9+
padding: 0;
10+
}
11+
12+
/*
13+
* Apply the nicer `border-box` value to make life easier when sizing elements.
314
*/
415

5-
label[for] {
6-
cursor: pointer;
16+
html {
17+
box-sizing: border-box;
18+
}
19+
20+
*,
21+
*::before,
22+
*::after {
23+
box-sizing: inherit;
724
}
825

926
/**
@@ -18,36 +35,13 @@ label[for] {
1835
outline: none !important;
1936
}
2037

21-
/**
22-
* Avoid 300ms click delay on touch devices that support the `touch-action` CSS
23-
* property.
24-
*
25-
* ✌︎ Resources and credit
26-
* http://caniuse.com/#feat=css-touch-action
27-
* http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
28-
* https://adactio.com/journal/10019
29-
* https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away
30-
*/
31-
32-
a,
33-
area,
34-
button,
35-
input,
36-
label,
37-
select,
38-
summary,
39-
textarea,
40-
[tabindex]:not([tabindex='-1']) {
41-
touch-action: manipulation;
42-
}
43-
4438
/**
4539
* Removes the outline in cases where the UA determines via heuristics that the
4640
* focus should not be visible. This is mainly for ensuring that a focus
4741
* indicator (a "focus ring") does not render for mouse users.
4842
*/
4943

50-
:focus:not(:focus-visible) {
44+
*:focus:not(:focus-visible) {
5145
outline: none;
5246
}
5347

@@ -67,3 +61,26 @@ textarea,
6761
transition: none !important;
6862
}
6963
}
64+
65+
/**
66+
* Print styles.
67+
*/
68+
69+
@media print {
70+
/**
71+
* 1. Remove styles that are poor for printing.
72+
* 2. Black prints faster.
73+
*
74+
* NOTE: it's okay to use `!important` here as we're doing it pre-emptively,
75+
* i.e., we always want these rules to take precedence.
76+
*/
77+
78+
*,
79+
*::after,
80+
*::before {
81+
background: transparent !important; /* 1 */
82+
box-shadow: none !important; /* 1 */
83+
color: black !important; /* 2 */
84+
text-shadow: none !important; /* 1 */
85+
}
86+
}

src/grouped.css

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* 1. Set the font family to use a monospace system font.
3+
* ✌︎ Credit https://github.com/sindresorhus/modern-normalize
4+
* 2. Set OpenType features. Remove kerning and common/standard ligatures.
5+
* Enable lining numerals, tabular numerals, and slashed zero.
6+
* NOTE: See the "OpenType features" section in the README.md.
7+
*/
8+
9+
code,
10+
kbd,
11+
pre,
12+
samp {
13+
font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; /* 1 */
14+
font-feature-settings: 'kern' 0, 'liga' 0, 'clig' 0, 'onum' 0, 'pnum' 0,
15+
'tnum', 'lnum', 'zero'; /* 2 */
16+
font-kerning: none; /* 2 */
17+
font-variant-ligatures: contextual; /* 2 */
18+
font-variant-numeric: lining-nums tabular-nums slashed-zero; /* 2 */
19+
}
20+
21+
/*
22+
* Remove the gap between the following elements and the bottom of their
23+
* containers.
24+
*
25+
* ✌︎ Resources and credit
26+
* https://github.com/h5bp/html5-boilerplate/issues/440
27+
* https://github.com/h5bp/html5-boilerplate
28+
*/
29+
30+
audio,
31+
canvas,
32+
iframe,
33+
img,
34+
svg,
35+
video {
36+
vertical-align: middle;
37+
}
38+
39+
/**
40+
* Avoid 300ms click delay on touch devices that support the `touch-action` CSS
41+
* property.
42+
*
43+
* ✌︎ Resources and credit
44+
* http://caniuse.com/#feat=css-touch-action
45+
* http://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay
46+
* https://adactio.com/journal/10019
47+
* https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away
48+
*/
49+
50+
a,
51+
area,
52+
button,
53+
input,
54+
label,
55+
select,
56+
summary,
57+
textarea,
58+
[tabindex]:not([tabindex='-1']) {
59+
touch-action: manipulation;
60+
}
61+
62+
/**
63+
* Print styles.
64+
*/
65+
66+
@media print {
67+
tr,
68+
img {
69+
page-break-inside: avoid;
70+
}
71+
72+
p,
73+
h2,
74+
h3 {
75+
orphans: 3;
76+
widows: 3;
77+
}
78+
}

src/index.css

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,13 @@
44
* https://github.com/chris-pearce/backpack.css
55
*/
66

7-
/**
8-
* Contents
9-
*
10-
* 1. normalize.css ‡
11-
* 2. Resets
12-
* 3. Main root †
13-
* 4. Forms †
14-
* 5. Content sectioning †
15-
* 6. Inline text semantics †
16-
* 7. Text content †
17-
* 8. Image and multimedia †
18-
* 9. Table content †
19-
* 10. Typography
20-
* 11. Interactive
21-
* 12. Print
22-
*
23-
* ‡ Comes from 'node_modules'.
24-
* † Section names come from MDN's HTML elements reference document. See:
25-
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element.
26-
*/
27-
287
@import 'normalize.css';
29-
@import 'resets.css';
8+
@import 'global.css';
309
@import 'main-root.css';
3110
@import 'forms.css';
3211
@import 'content-sectioning.css';
3312
@import 'inline-text-semantics.css';
3413
@import 'text-content.css';
3514
@import 'image-and-multimedia.css';
3615
@import 'table-content.css';
37-
@import 'typography.css';
38-
@import 'interactive.css';
39-
@import 'print.css';
16+
@import 'grouped.css';

src/inline-text-semantics.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,64 @@ em {
1414
small {
1515
font-size: 100%;
1616
}
17+
18+
/**
19+
* normalize.css normalizes the `<sub>` and `<sup>` elements, however, if
20+
* user-agents support the `font-variant-position` property then we use that
21+
* instead and remove the relevant normalize.css styles.
22+
*/
23+
24+
@supports (font-variant-position: sub) and (font-variant-position: super) {
25+
sub,
26+
sup {
27+
font-size: 100%;
28+
line-height: inherit;
29+
position: static;
30+
}
31+
32+
sub {
33+
font-variant-position: sub;
34+
}
35+
36+
sup {
37+
font-variant-position: super;
38+
}
39+
}
40+
41+
/**
42+
* Print styles.
43+
*/
44+
45+
@media print {
46+
/**
47+
* Make links always stand out.
48+
*/
49+
50+
a,
51+
a:visited {
52+
text-decoration: underline;
53+
}
54+
55+
/**
56+
* Show the `[href]` and `[title]` attribute values of links and abbreviations
57+
* via their `::after` pseudo element.
58+
*/
59+
60+
a[href]::after {
61+
content: ' (' attr(href) ')';
62+
}
63+
64+
abbr[title]::after {
65+
content: ' (' attr(title) ')';
66+
}
67+
68+
/**
69+
* Don't show links that are fragment identifiers or use the `javascript:`
70+
* pseudo protocol.
71+
*/
72+
73+
a[href^='javascript:']::after,
74+
a[href^='#']::after {
75+
content: '';
76+
}
77+
}

src/main-root.css

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Set a more readable tab size.
33
*
4-
* ✌︎ Credit https://github.com/sindresorhus/modern-normalize/issues/17.
4+
* ✌︎ Credit https://github.com/sindresorhus/modern-normalize/issues/17
55
*/
66

77
:root {
@@ -15,14 +15,24 @@
1515
* https://github.com/primer/primer/pull/408
1616
* https://infinnie.github.io/blog/2017/systemui.html
1717
* http://markdotto.com/2018/02/07/github-system-fonts/
18-
* 2. Set the font size of the entire document using the default user-agent size
18+
* 2. Set OpenType features for the entire document. Enable kerning,
19+
* common/standard ligatures, contextual ligatures, and proportional,
20+
* oldstyle numerals.
21+
* NOTE: if any of the `font-feature-settings` values aren't needed on child
22+
* elements, e.g.: `<td>`, then you have to explicitly turn them off. Also,
23+
* see the "OpenType features" section in the README.md.
24+
* 3. Set the font size of the entire document using the default user-agent size
1925
* which is typically 16px.
20-
* 3. Increase the line height from normalize.css's small '1.15' value. The
26+
* 4. Increase the line height from normalize.css's small '1.15' value. The
2127
* larger '1.5' value is recommended by the W3C Web Accessibility Initiative.
2228
*/
2329

2430
html {
2531
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif,'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; /* 1 */
26-
font-size: 1rem; /* 2 */
27-
line-height: 1.5; /* 3 */
32+
font-feature-settings: 'kern', 'liga', 'clig', 'calt', 'onum', 'pnum'; /* 2 */
33+
font-kerning: normal; /* 2 */
34+
font-size: 1rem; /* 3 */
35+
font-variant-ligatures: common-ligatures contextual; /* 2 */
36+
font-variant-numeric: oldstyle-nums proportional-nums; /* 2 */
37+
line-height: 1.5; /* 4 */
2838
}

0 commit comments

Comments
 (0)