Skip to content

Commit 8cb99fc

Browse files
Amend .clean-list class to only remove bullets
Lists in the nav element still have bullets and margin/padding removed
1 parent 9474f03 commit 8cb99fc

File tree

1 file changed

+77
-69
lines changed

1 file changed

+77
-69
lines changed

assets-src/styles/sass/30-base/_lists.scss

Lines changed: 77 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,32 @@
44

55
ul,
66
ol {
7-
margin-block: 1rem;
8-
padding-inline-start: 2.4em;
7+
margin-block: 1rem;
8+
padding-inline-start: 2.4em;
99

10-
li {
11-
max-inline-size: rem($text-measure);
12-
}
10+
li {
11+
max-inline-size: rem($text-measure);
12+
}
1313

14-
li + li {
15-
margin-block-start: 0.75rem;
16-
}
14+
li + li {
15+
margin-block-start: 0.75rem;
16+
}
1717
}
1818

1919
ol.counter {
20-
::marker {
21-
content: counters(list-item, ".") ". ";
22-
}
20+
::marker {
21+
content: counters(list-item, ".") ". ";
22+
}
2323
}
2424

2525

2626
/**
27-
Remove bullets, margin and padding from lists inside a <nav> element, and lists with the
28-
'.clean-list' class/. Note that that this may remove list semantics in some circumstances in
29-
some WebKit browsers. See https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html
27+
Remove bullets, margin and padding from lists inside a <nav> element.
28+
Note that that this may remove list semantics in some circumstances in some
29+
WebKit browsers. See https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html
3030
If it's important that the number of items in a list is announced, add role="list" to the <ul> / <ol>
3131
*/
32-
nav ul,
33-
nav ol,
34-
.clean-list {
32+
nav :is(ul, ol) {
3533
list-style: none;
3634
margin: 0;
3735
padding: 0;
@@ -44,78 +42,88 @@ nav ol,
4442
}
4543
}
4644

45+
/**
46+
Remove bullets from lists with the `.clean-list, class.
47+
Note that that this may remove list semantics in some circumstances in some
48+
WebKit browsers. See https://www.scottohara.me/blog/2019/01/12/lists-and-safari.html
49+
If it's important that the number of items in a list is announced, add role="list" to the <ul> / <ol>
50+
*/
51+
.clean-list {
52+
list-style: none;
53+
}
54+
4755

4856
/**
4957
Description lists / Definition lists
5058
*/
5159
dl {
52-
margin-block: 1rem;
53-
max-inline-size: rem($text-measure);
60+
margin-block: 1rem;
61+
max-inline-size: rem($text-measure);
5462

55-
dt {
56-
font-weight: bold;
57-
}
63+
dt {
64+
font-weight: bold;
65+
}
5866

5967
dd {
6068
margin-inline-start: rem(40);
6169
}
6270

63-
dd + dt {
64-
margin-block-start: 0.5em;
65-
}
71+
dd + dt {
72+
margin-block-start: 0.5em;
73+
}
6674

67-
dt + dd,
68-
dd + dd {
69-
margin-block-start: 0.25em;
70-
}
75+
dt + dd,
76+
dd + dd {
77+
margin-block-start: 0.25em;
78+
}
7179
}
7280

7381
// display items on the same line (comma-separated)
7482
dl.inline {
75-
div {
76-
align-items: baseline;
77-
display: flex;
78-
flex-wrap: wrap;
79-
80-
dt, dd {
81-
margin-inline-start: 0;
82-
}
83-
84-
dt::after {
85-
content: ":\00a0 ";
86-
}
87-
88-
dd:not(:last-child):after {
89-
content: ',\00a0 ';
90-
}
91-
}
83+
div {
84+
align-items: baseline;
85+
display: flex;
86+
flex-wrap: wrap;
87+
88+
dt, dd {
89+
margin-inline-start: 0;
90+
}
91+
92+
dt::after {
93+
content: ":\00a0 ";
94+
}
95+
96+
dd:not(:last-child):after {
97+
content: ',\00a0 ';
98+
}
99+
}
92100
}
93101

94102
// With a grid layout for a more tabulated feel
95103

96104
dl.grid {
97-
@supports (grid-row-start: auto) {
98-
column-gap: 1rem;
99-
display: grid;
100-
grid-template-columns: max-content;
101-
grid-template-rows: 1fr;
102-
row-gap: 1rem;
103-
104-
dd + dt,
105-
dt + dd,
106-
dd + dd {
107-
margin-block-start: 0;
108-
}
109-
110-
dt {
111-
grid-column-start: 1;
112-
grid-column-end: 2;
113-
}
114-
115-
dd {
116-
grid-column-start: 2;
117-
grid-column-end: 3;
105+
@supports (grid-row-start: auto) {
106+
column-gap: 1rem;
107+
display: grid;
108+
grid-template-columns: max-content;
109+
grid-template-rows: 1fr;
110+
row-gap: 1rem;
111+
112+
dd + dt,
113+
dt + dd,
114+
dd + dd {
115+
margin-block-start: 0;
116+
}
117+
118+
dt {
119+
grid-column-start: 1;
120+
grid-column-end: 2;
121+
}
122+
123+
dd {
124+
grid-column-start: 2;
125+
grid-column-end: 3;
118126
margin-inline-start: 0;
119-
}
120-
}
127+
}
128+
}
121129
}

0 commit comments

Comments
 (0)