Last active
November 18, 2020 08:52
-
-
Save Xananax/ee4895367405a364499701f1d367dbcb to your computer and use it in GitHub Desktop.
Useful CSS Reset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
copied from: https://meowni.ca/posts/monica-dot-css/ & https://hankchizljaw.com/wrote/a-modern-css-reset/ | |
**/ | |
/* Box sizing rules */ | |
*, *::before, *::after { | |
box-sizing: border-box; | |
} | |
/* Remove default padding */ | |
ul[class], ol[class] { | |
padding: 0; | |
list-style: none; | |
} | |
/* Remove default margin */ | |
body, | |
h1, | |
h2, | |
h3, | |
h4, | |
p, | |
ul[class], | |
ol[class], | |
li, | |
figure, | |
figcaption, | |
blockquote, | |
dl, | |
dd { | |
margin: 0; | |
} | |
/* A elements that don't have a class get default styles */ | |
a:not([class]) { | |
text-decoration-skip-ink: auto; | |
} | |
/* Make images easier to work with */ | |
img { | |
max-width: 100%; | |
display: inline-block; | |
} | |
/* Natural flow and rhythm in articles by default */ | |
article > * + * { | |
margin-top: 1em; | |
} | |
/* Inherit fonts for inputs and buttons */ | |
input, | |
button, | |
textarea, | |
select { | |
font: inherit; | |
} | |
/* Remove all animations and transitions for people that prefer not to see them */ | |
@media (prefers-reduced-motion: reduce) { | |
* { | |
animation-duration: 0.01ms !important; | |
animation-iteration-count: 1 !important; | |
transition-duration: 0.01ms !important; | |
scroll-behavior: auto !important; | |
} | |
} | |
/* make sure hidden inputs don't show */ | |
[hidden] {display: none !important} | |
/* make sure disabled inputs aren't clickable */ | |
[disabled] {pointer-events:none; opacity: 0.3} | |
/* helper classes */ | |
.horizontal {display: flex; flex-direction: row; justify-content: space-between} | |
.vertical {display: flex; flex-direction: column} | |
.center {justify-content: center; align-items: center} | |
.flex {flex: 1} | |
/* Set core body defaults */ | |
body { | |
min-height: 100vh; | |
scroll-behavior: smooth; | |
text-rendering: optimizeSpeed; | |
line-height: 1.5; | |
} | |
/* some good variables to use throughout the project */ | |
html { | |
--spacing-xs: 8px; | |
--spacing: 24px; | |
--spacing-s: 12px; | |
--spacing-m: 36px; | |
} | |
/* https://remysharp.com/links/2020-08-26-9d483db3 */ | |
:focus:not(:focus-visible) { outline: none; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment