@@ -10,20 +10,64 @@ export default css`
1010 column-gap : 2em ;
1111}
1212
13+ /* The dl is a new wrapper around the groups, so it has to be transparent to
14+ the flex row that used to hold them directly. */
15+ .caniuse-groups {
16+ display : flex;
17+ flex : 1 ;
18+ column-gap : 2em ;
19+ margin : 0 ;
20+ }
21+
22+ /* Narrow screens: stack the groups full width so the pills wrap instead of
23+ forming tall single-file columns, and give "More info" its own row.
24+ 767px matches the only other breakpoint in ReSpec (respec.css.js). */
25+ @media (max-width : 767px ) {
26+ .caniuse-stats {
27+ display : block;
28+ }
29+
30+ .caniuse-groups {
31+ flex-direction : column;
32+ }
33+
34+ /* Space every group equally, including the first. Using padding rather than
35+ row-gap avoids the second group getting gap plus padding while the first
36+ gets padding alone. Generous, because each group's label hangs below its
37+ own rule, and a tight gap reads as the label belonging to the group
38+ beneath it. */
39+ .caniuse-group {
40+ padding-top : 1.5em ;
41+ }
42+
43+ .caniuse-more-info {
44+ display : block;
45+ text-align : right;
46+ margin-top : 0.5em ;
47+ }
48+ }
49+
50+ /* column-reverse, not column: a dl requires the dt before its dd, but the
51+ label belongs visually below, straddling the rule under the browsers. */
1352.caniuse-group {
1453 display : flex;
1554 flex : 1 ;
16- flex-direction : column;
55+ flex-direction : column-reverse ;
1756 justify-content : flex-end;
1857 flex-basis : auto;
58+ /* Establish a stacking context so the label can be lifted above the dd's
59+ bottom border. Reversing the visual order does not reverse paint order:
60+ the dd is a later sibling, so its border would paint over the label and
61+ strike the text through. */
62+ position : relative;
1963}
2064
2165.caniuse-browsers {
2266 display : flex;
2367 align-items : baseline;
2468 justify-content : space-between;
2569 flex-wrap : wrap;
26- margin-top : .2em ;
70+ margin : .2em 0 0 ;
2771 column-gap : .4em ;
2872 border-bottom : 1px solid # ccc ;
2973 row-gap : .4em ;
@@ -37,10 +81,20 @@ export default css`
3781 font-size : .8em ;
3882 margin-top : -.8em ;
3983 font-weight : bold;
84+ /* Above the dd's border, so the label's background breaks the rule instead
85+ of the rule striking through the text. */
86+ position : relative;
87+ z-index : 1 ;
4088}
4189
90+ /* The label punches a hole in the rule above it, so its background has to match
91+ the page. This was var(--bg, white), but --bg is defined nowhere in ReSpec,
92+ so it always resolved to literal white: a white patch on a dark page.
93+ Canvas/CanvasText are system colours that follow the used color-scheme, so
94+ this tracks both the OS preference and ReSpec's own dark toggle. */
4295.caniuse-type span {
43- background-color : var (--bg , white);
96+ background-color : Canvas;
97+ color : CanvasText;
4498 padding : 0 0.4em ;
4599}
46100
@@ -83,7 +137,7 @@ img.caniuse-browser {
83137 font-size : .9em ;
84138}
85139
86- .caniuse-stats a [ href ] {
140+ .caniuse-more-info {
87141 white-space : nowrap;
88142 align-self : flex-end;
89143}
@@ -118,6 +172,17 @@ see https://github.com/Fyrd/caniuse/blob/master/CONTRIBUTING.md for stats */
118172
119173/* handle case when printing */
120174@media print {
175+ /* Browsers drop backgrounds when printing, so the label can no longer punch
176+ a hole in the rule and the line would strike through the text. Drop the
177+ rule instead and let the label sit under its group. */
178+ .caniuse-browsers {
179+ border-bottom : none;
180+ }
181+
182+ .caniuse-type {
183+ margin-top : 0 ;
184+ }
185+
121186 .caniuse-cell .y ::before {
122187 content : "✔️" ;
123188 padding : 0.5em ;
0 commit comments