-
When writing a string of multiple utility classes, always do so in an order with meaning. The "Concentric CSS" approach works well with utility classes (i.e,. 1. positioning/visibility 2. box model 3. borders 4. backgrounds 5. typography 6. other visual adjustments). Once you establish a familiar pattern of ordering, parsing through long strings of utility classes will become much, much faster so a little more effort up front goes a long way!
-
Always use fewer utility classes when possible. For example, use
mx-2
instead ofml-2 mr-2
and don't be afraid to use the simplerp-4 lg:pt-8
instead of the longer, more complicatedpt-4 lg:pt-8 pr-4 pb-4 pl-4
. -
Prefix all utility classes that will only apply at a certain breakpoint with that breakpoint's prefix. For example, use
block lg:flex lg:flex-col lg:justify-center
instead ofblock lg:flex flex-col justify-center
to make it very clear that the flexbox utilities are only applicable at the
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
[{ | |
"id": 1, | |
"name": { | |
"english": "Bulbasaur", | |
"japanese": "フシギダネ", | |
"chinese": "妙蛙种子", | |
"french": "Bulbizarre" | |
}, | |
"type": [ | |
"Grass", |
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
import React from 'react'; | |
import GatsbyImage from 'gatsby-image'; | |
import PropTypes from 'prop-types'; | |
const Image = ({ objectFit, objectPosition, ...rest }) => { | |
let wrapperStyles = {}; | |
let imageStyles = {}; | |
if (objectFit === 'contain') { | |
wrapperStyles.width = '100%'; |
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
@tailwind base; | |
/* | |
* Oldschool, top left anchored repeating backgrounds should be opt-in instead | |
* of opt-out in 2022, lol. | |
*/ | |
*, | |
*::before, | |
*::after { | |
min-width: 0; |
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
.text-6pt { | |
font-size: 0.5rem; | |
} | |
.text-7pt { | |
font-size: 0.58333rem; | |
} | |
.text-8pt { | |
font-size: 0.66667rem; |