Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Last active December 8, 2020 03:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasvirkus/339d0696572c6591ae31e981bcdd771c to your computer and use it in GitHub Desktop.
Save andreasvirkus/339d0696572c6591ae31e981bcdd771c to your computer and use it in GitHub Desktop.
When I'm too lazy to set up Tailwind and PurgeCSS for a prototype or a small project, then this will do.
/* Handicraft reset */
*,
*::before,
*::after {
box-sizing: inherit;
}
html {
box-sizing: border-box;
}
body {
min-height: 100vh;
}
body,
body * {
margin: 0;
padding: 0;
}
body,
button,
input,
textarea {
font-family: -apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
ol,
ul {
list-style: none;
}
/* Global styles */
:root {
--brand: #223;
--gray: #8c8c8c;
--contrast: #475DE5;
}
h1 {
font-size: 1.875rem;
line-height: 2.25rem;
color: var(--gray-80);
font-weight: 700;
}
button {
display: block;
border: none;
background: none;
color: inherit;
font-size: inherit;
}
button[disabled],
.cursor-disabled {
cursor: not-allowed;
}
label,
button,
.cursor-pointer {
cursor: pointer;
}
.break-all {
word-break: break-all;
}
.break-word {
word-break: break-word;
}
a {
text-decoration: none;
color: inherit;
}
.content-link {
display: inline-block;
color: var(--brand);
font-weight: 500;
}
.content-link:hover {
text-decoration: underline;
}
::placeholder {
color: var(--gray);
}
::selection {
background-color: var(--contrast);
color: white;
}
.profile-image {
border-radius: 50%;
height: 2rem;
width: 2rem;
}
.bg-none {
background-color: transparent;
}
.border-top {
border-top: 1px solid var(--gray);
}
.border-right {
border-right: 1px solid var(--gray);
}
.border-bottom {
border-bottom: 1px solid var(--gray);
}
.border-left {
border-left: 1px solid var(--gray);
}
.color-white {
color: white;
}
.color-contrast {
color: var(--contrast);
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
.text-left {
text-align: left;
}
.text-ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.text-uppercase {
text-transform: uppercase;
}
.icon-xs {
height: 0.7rem;
width: 0.7rem;
}
.icon-s {
height: 0.825rem;
width: 0.825rem;
}
.icon-m {
height: 1rem;
width: 1rem;
}
.icon-l {
height: 1.5rem;
width: 1.5rem;
}
.icon--flipped-y {
transform: rotateY(180deg);
}
.icon--flipped-x {
transform: rotateX(180deg);
}
.icon--flipped {
transform: rotate(180deg);
}
.icon--rotated-left {
transform: rotate(-90deg);
}
.icon--rotated-right {
transform: rotate(90deg);
}
.padded-s {
padding: 0.5rem;
}
.padded-m {
padding: 1rem;
}
.padded-l {
padding: 1.5rem;
}
.padded-xl {
padding: 2rem;
}
.padded-0 {
padding: 0 !important;
}
.padded {
padding: 1rem;
}
.anim-spin {
animation: spin 2s ease-out infinite;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
.anim-shake {
animation: shake 0.85s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
}
30%,
50%,
70% {
transform: translate3d(-4px, 0, 0);
}
40%,
60% {
transform: translate3d(4px, 0, 0);
}
}
.hidden-visually {
pointer-events: none !important;
position: fixed !important;
opacity: 0 !important;
top: -10vh;
}
@media screen and (min-width: 65.01rem) {
.hidden-wide {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.hidden-wide--shift {
display: none;
}
}
@media screen and (max-width: 65rem) {
.hidden-medium {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.hidden-medium--shift {
display: none;
}
}
@media screen and (max-width: 40rem) {
.hidden-narrow {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.hidden-narrow--shift {
display: none;
}
}
.weight-default {
font-weight: 400;
}
.weight-m,
.weight-bold {
font-weight: 500;
}
.weight-l,
.weight-bolder {
font-weight: 700;
}
.font-s {
font-size: 0.875rem;
}
.font-xs {
font-size: 0.75rem;
}
.font-l {
font-size: 1.25rem;
}
.intrinsic {
position: relative;
height: 0;
padding-bottom: calc(100% / (var(--aspect-ratio)));
}
.intrinsic-content {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
.full-height {
height: 100%;
}
.f-v-center {
display: flex;
align-items: center;
}
.f-h-center {
display: flex;
justify-content: center;
}
.f-center {
display: flex;
align-items: center;
justify-content: center;
}
.f-space {
display: flex;
justify-content: space-between;
}
.f-start {
display: flex;
justify-content: flex-start;
}
.f-end {
display: flex;
justify-content: flex-end;
}
.f-row {
display: flex;
flex-direction: row;
}
.f-row-reverse {
display: flex;
flex-direction: row-reverse;
}
.f-col {
display: flex;
flex-direction: column;
}
.f-col-reverse {
display: flex;
flex-direction: column-reverse;
}
.f-grow {
flex-grow: 1;
}
.d-inline-block {
display: inline-block;
}
.d-inline-flex {
display: inline-flex;
}
.m-right-xxs {
margin-right: 0.25rem;
}
.m-right-xs {
margin-right: 0.5rem;
}
.m-right-s {
margin-right: 0.75rem;
}
.m-right-m {
margin-right: 1.5rem;
}
.m-right-l {
margin-right: 3rem;
}
.m-right-a {
margin-right: auto;
}
.m-left-xxs {
margin-left: 0.25rem;
}
.m-left-xs {
margin-left: 0.5rem;
}
.m-left-s {
margin-left: 0.75rem;
}
.m-left-m {
margin-left: 1.5rem;
}
.m-left-a {
margin-left: auto;
}
.m-top-xxs {
margin-top: 0.25rem;
}
.m-top-xs {
margin-top: 0.5rem;
}
.m-top-s {
margin-top: 0.75rem;
}
.m-top-m {
margin-top: 1.5rem;
}
.m-top-l {
margin-top: 3rem;
}
.m-bottom-xxs {
margin-bottom: 0.25rem;
}
.m-bottom-xs {
margin-bottom: 0.5rem;
}
.m-bottom-s {
margin-bottom: 0.75rem;
}
.m-bottom-m {
margin-bottom: 1.5rem;
}
.m-bottom-l {
margin-bottom: 3rem;
}
.m-a-l {
margin: 3rem;
}
.m-a-s {
margin: 1rem;
}
.m-a-m {
margin: 1.5rem;
}
.m-x-l {
margin-left: 3rem;
margin-right: 3rem;
}
.m-x-m {
margin-left: 1.5rem;
margin-right: 1.5rem;
}
.m-x-s {
margin-left: 1rem;
margin-right: 1rem;
}
.m-x-xs {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.m-x-xxs {
margin-left: 0.2rem;
margin-right: 0.2rem;
}
.m-left-0 {
margin-left: 0 !important;
}
.m-bottom-0 {
margin-bottom: 0 !important;
}
/* Custom scrollbars */
:root {
--scrollbar-size: 6px;
--scrollbar-minlength: 24px;
--scrollbar-track-color: transparent;
--scrollbar-color: rgba(74, 85, 104, 0.3);
}
.scrollbar-test {
overflow-y: auto;
}
* {
scrollbar-width: thin;
scrollbar-color: var(--scrollbar-color) var(--scrollbar-track-color);
}
.layout-scrollbar-obtrusive *::-webkit-scrollbar {
height: var(--scrollbar-size);
width: var(--scrollbar-size);
}
::-webkit-scrollbar-track {
background-color: var(--scrollbar-track-color);
}
::-webkit-scrollbar-thumb {
background-color: var(--scrollbar-color);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:vertical,
::-webkit-scrollbar-thumb:vertical {
min-height: var(--scrollbar-minlength);
}
::-webkit-scrollbar-thumb:horizontal,
::-webkit-scrollbar-thumb:horizontal {
min-width: var(--scrollbar-minlength);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment