Skip to content

Commit 258d349

Browse files
Merge pull request #9574 from circleci/DOCSS-1904-heading-styles
Clean up heading styles
2 parents d7eaf39 + a92758a commit 258d349

File tree

2 files changed

+47
-43
lines changed

2 files changed

+47
-43
lines changed

ui/src/css/doc.css

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,72 @@
1717
}
1818
}
1919

20+
/* === HEADING STYLES === */
2021
.doc h1,
2122
.doc h2,
2223
.doc h3,
2324
.doc h4,
2425
.doc h5,
2526
.doc h6 {
2627
color: var(--heading-font-color);
28+
font-family: var(--body-font-family);
2729
font-weight: var(--heading-font-weight);
2830
hyphens: none;
2931
line-height: 1.3;
30-
margin: 1rem 0 0;
31-
scroll-margin-top: calc(var(--navbar-height) + var(--toolbar-height) + 1rem); /* Account for sticky header height */
32+
margin: 16px 0;
33+
padding: 0;
34+
text-align: left;
35+
scroll-margin-top: calc(var(--navbar-height) + var(--toolbar-height) + 1rem);
3236
}
3337

34-
.doc > h1.page:first-child {
38+
.doc h1 {
3539
font-size: 32px;
36-
margin: 16px 0;
3740
}
3841

42+
.doc h2 {
43+
font-size: 24px;
44+
}
45+
46+
.doc h3 {
47+
font-size: 20px;
48+
}
49+
50+
.doc h4 {
51+
font-size: 18px;
52+
}
53+
54+
.doc h5,
55+
.doc h6 {
56+
font-size: 16px;
57+
}
58+
59+
/* Mobile heading sizes */
60+
@media screen and (max-width: 1023.5px) {
61+
.doc h1 {
62+
font-size: 24px;
63+
}
64+
65+
.doc h2 {
66+
font-size: 20px;
67+
}
68+
69+
.doc h3 {
70+
font-size: 18px;
71+
}
72+
73+
.doc h4 {
74+
font-size: 16px;
75+
}
76+
}
77+
78+
/* Special case: Page title gets extra top margin on larger screens */
3979
@media screen and (min-width: 768px) {
4080
.doc > h1.page:first-child {
4181
margin-top: 2.5rem;
4282
}
4383
}
4484

85+
/* Special case: Section spacing */
4586
.doc > h2#name + .sectionbody {
4687
margin-top: 1rem;
4788
}
@@ -51,26 +92,14 @@
5192
margin-top: 2rem;
5293
}
5394

95+
/* Special case: Abstract section header with background */
5496
.doc h1.sect0 {
5597
background: var(--abstract-background);
5698
font-size: 1.8em;
5799
margin: 1.5rem -1rem 0;
58100
padding: 0.5rem 1rem;
59101
}
60102

61-
.doc h2:not(.discrete) {
62-
margin-left: -1rem;
63-
margin-right: -1rem;
64-
padding: 0.4rem 1rem 0.1rem;
65-
font-weight: var(--alt-heading-font-weight);
66-
}
67-
68-
.doc h3:not(.discrete),
69-
.doc h4:not(.discrete) {
70-
font-weight: var(--alt-heading-font-weight);
71-
font-size: 20px;
72-
}
73-
74103
.doc h1 .anchor,
75104
.doc h2 .anchor,
76105
.doc h3 .anchor,
@@ -1321,31 +1350,6 @@
13211350
width: 1.5em;
13221351
}
13231352

1324-
/* === custom overrides === */
1325-
/* uniform 16px (1rem) spacing and left alignment */
1326-
.doc h1,
1327-
.doc h2,
1328-
.doc h3,
1329-
.doc h4,
1330-
.doc h5,
1331-
.doc h6 {
1332-
margin: 16px 0;
1333-
padding: 0;
1334-
text-align: left;
1335-
margin-left: 0;
1336-
margin-right: 0;
1337-
font-size: 24px;
1338-
font-weight: 500;
1339-
}
1340-
1341-
/* remove negative offsets on section headers */
1342-
.doc h2:not(.discrete),
1343-
.doc h3:not(.discrete),
1344-
.doc h4:not(.discrete) {
1345-
margin-left: 0;
1346-
margin-right: 0;
1347-
padding: 0;
1348-
}
13491353

13501354
/* paragraphs, lists, tables, blockquotes all get 16px bottom spacing */
13511355
.doc p,

ui/src/css/vars.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
--doc-margin: 0 auto;
8282
--doc-margin--desktop: 0 2rem;
8383
--heading-font-color: #161616;
84-
--heading-font-weight: normal;
84+
--heading-font-weight: 500;
8585
--alt-heading-font-weight: 500;
8686
--section-divider-color: var(--panel-border-color);
8787
--link-font-color: #2152E5;

0 commit comments

Comments
 (0)