From 6da1de665bdc665f6076aa8f8dae1c643bcc7d81 Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Mon, 15 Apr 2024 03:04:25 +0800 Subject: [PATCH] Replace CSS reset --- src/assets/css/main.css | 65 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 6f34d4d0..76237c4e 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -46,17 +46,16 @@ box-sizing: border-box; } -/* Remove default margin */ -body, -h1, -h2, -h3, -h4, -p, -figure, -blockquote, -dl, -dd { +/* Prevent font size inflation */ +html { + -moz-text-size-adjust: none; + -webkit-text-size-adjust: none; + text-size-adjust: none; +} + +/* Remove default margin in favour of better control in authored CSS */ +body, h1, h2, h3, h4, p, +figure, blockquote, dl, dd { margin: 0; } @@ -66,18 +65,24 @@ ol[role='list'] { list-style: none; } -/* Set core root defaults */ -html:focus-within { - scroll-behavior: smooth; -} - /* Set core body defaults */ body { min-height: 100vh; - text-rendering: optimizeSpeed; line-height: 1.5; } +/* Set shorter line heights on headings and interactive elements */ +h1, h2, h3, h4, +button, input, label { + line-height: 1.1; +} + +/* Balance text wrapping on headings */ +h1, h2, +h3, h4 { + text-wrap: balance; +} + /* A elements that don't have a class get default styles */ a:not([class]) { text-decoration-skip-ink: auto; @@ -91,27 +96,19 @@ picture { } /* Inherit fonts for inputs and buttons */ -input, -button, -textarea, -select { +input, button, +textarea, select { font: inherit; } -/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */ -@media (prefers-reduced-motion: reduce) { - html:focus-within { - scroll-behavior: auto; - } +/* Make sure textareas without a rows attribute are not tiny */ +textarea:not([rows]) { + min-height: 10em; +} - *, - *::before, - *::after { - animation-duration: 0.01ms !important; - animation-iteration-count: 1 !important; - transition-duration: 0.01ms !important; - scroll-behavior: auto !important; - } +/* Anything that has been anchored to should have extra scroll margin */ +:target { + scroll-margin-block: 5ex; } /* ------------------- */