Skip to content

Commit f70bb05

Browse files
committed
Cleanup: Update in Prose and headline.
1 parent 9a168bf commit f70bb05

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

src/components/ui/Headline.astro

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,73 @@ const isCenter = center ? "text-center" : "";
2020
</Tag>
2121

2222
<style>
23+
h1,
24+
h2,
25+
h3,
26+
h4,
27+
h5,
28+
h6 {
29+
font-weight: 500;
30+
font-family: var(--font-display);
31+
line-height: 1.25;
32+
33+
/* https://css-tricks.com/linearly-scale-font-size-with-css-clamp-based-on-the-viewport/ */
34+
35+
--min-fs: 1;
36+
--max-fs: 1.5;
37+
--min-vw: 20;
38+
--max-vw: 45;
39+
40+
--min-fs-rem: var(--min-fs) * 1rem;
41+
--max-fs-rem: var(--max-fs) * 1rem;
42+
--min-vw-rem: var(--min-vw) * 1rem;
43+
44+
--slope: (var(--max-fs) - var(--min-fs)) * (100vw - var(--min-vw-rem)) /
45+
(var(--max-vw) - var(--min-vw));
46+
47+
font-size: clamp(
48+
var(--min-fs-rem),
49+
var(--min-fs-rem) + var(--slope),
50+
var(--max-fs-rem)
51+
);
52+
}
53+
54+
h1 {
55+
/* 36 px, 48px */
56+
--min-fs: 2.25;
57+
--max-fs: 3;
58+
}
59+
60+
h2 {
61+
/* 32px, 40px */
62+
--min-fs: 2;
63+
--max-fs: 2.5;
64+
}
65+
66+
h3 {
67+
/* 28px, 36px */
68+
--min-fs: 1.75;
69+
--max-fs: 2.25;
70+
}
71+
72+
h4 {
73+
/* 24px, 32px */
74+
--min-fs: 1.5;
75+
--max-fs: 2;
76+
}
77+
78+
h5 {
79+
/* 20px, 28px */
80+
--min-fs: 1.25;
81+
--max-fs: 1.75;
82+
}
83+
84+
h6 {
85+
/* 16px, 24px */
86+
--min-fs: 1;
87+
--max-fs: 1.5;
88+
}
89+
2390
a:hover {
2491
color:var(--color-primary-hover);
2592
}

0 commit comments

Comments
 (0)