Skip to content

Commit

Permalink
Update CSS reset
Browse files Browse the repository at this point in the history
[A newer version][1] has been published since I added this. This
updates a few rules to be more in line with that version. Exceptions
include:
- keeping the previous heading line height and margin styling
- keeping the `prefers-reduced-motion` rule. There shouldn't be any
  animation on the site at present - and perhaps never - but I'm keeping
  this just in case. [A Twitter thread][2] suggests it's still useful,
  just not needed in the reset for Andy/Set Studio because they always
  include it elsewhere

[1]: https://andy-bell.co.uk/a-more-modern-css-reset
[2]: https://x.com/IAmBramSmulders/status/1703813783976657043
  • Loading branch information
yndajas committed Dec 2, 2023
1 parent a4abf6e commit f238321
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions assets/styles/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
box-sizing: border-box;
}

/* Remove default margin */
/* Prevent font size inflation */
html {
text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
Expand Down Expand Up @@ -34,11 +39,19 @@ html:focus-within {
body {
min-height: 100vh;
line-height: 1.5;
text-rendering: optimizespeed;
}

/* 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]) {
color: currentcolor;
text-decoration-skip-ink: auto;
}

Expand All @@ -57,6 +70,16 @@ select {
font: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
scroll-margin-block: 5ex;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
html:focus-within {
Expand Down

0 comments on commit f238321

Please sign in to comment.