Replace CSS reset

This commit is contained in:
Helen Chong 2024-04-15 03:04:25 +08:00
parent dcd6894637
commit 6da1de665b
1 changed files with 31 additions and 34 deletions

View File

@ -46,17 +46,16 @@
box-sizing: border-box; box-sizing: border-box;
} }
/* Remove default margin */ /* Prevent font size inflation */
body, html {
h1, -moz-text-size-adjust: none;
h2, -webkit-text-size-adjust: none;
h3, text-size-adjust: none;
h4, }
p,
figure, /* Remove default margin in favour of better control in authored CSS */
blockquote, body, h1, h2, h3, h4, p,
dl, figure, blockquote, dl, dd {
dd {
margin: 0; margin: 0;
} }
@ -66,18 +65,24 @@ ol[role='list'] {
list-style: none; list-style: none;
} }
/* Set core root defaults */
html:focus-within {
scroll-behavior: smooth;
}
/* Set core body defaults */ /* Set core body defaults */
body { body {
min-height: 100vh; min-height: 100vh;
text-rendering: optimizeSpeed;
line-height: 1.5; 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 elements that don't have a class get default styles */
a:not([class]) { a:not([class]) {
text-decoration-skip-ink: auto; text-decoration-skip-ink: auto;
@ -91,27 +96,19 @@ picture {
} }
/* Inherit fonts for inputs and buttons */ /* Inherit fonts for inputs and buttons */
input, input, button,
button, textarea, select {
textarea,
select {
font: inherit; font: inherit;
} }
/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */ /* Make sure textareas without a rows attribute are not tiny */
@media (prefers-reduced-motion: reduce) { textarea:not([rows]) {
html:focus-within { min-height: 10em;
scroll-behavior: auto; }
}
*, /* Anything that has been anchored to should have extra scroll margin */
*::before, :target {
*::after { scroll-margin-block: 5ex;
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
} }
/* ------------------- */ /* ------------------- */