Learning CSS with utilities

One of the premises behind Bootstrap’s utilities is that each property: value pairing is attached to a class named after that pair—.property-value. Because of this pattern, creating and using utilities is an incredibly effective technique for learning …


This content originally appeared on @mdo and was authored by Mark Otto

One of the premises behind Bootstrap’s utilities is that each property: value pairing is attached to a class named after that pair—.property-value. Because of this pattern, creating and using utilities is an incredibly effective technique for learning CSS.

When I wasn’t as familiar with flexbox, the CSS-Tricks cheat sheet was indispensable, but I still found myself having to go back to it time and time again. Same with CSS Grid.

Originally added in v4 and refined in v5, Bootstrap has flexbox utilities and a flexbox-based grid to use flexbox instead of floats. With the need for a slew of new supporting utilities, I taught myself flexbox by writing out every new class we’d need.

.d-flex { display: flex; }
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
// etc

Writing all these out by hand for v4 gave me the muscle memory to remember specific patterns and behaviors for flexbox properties and values. It’s incredibly helpful that learning Bootstrap (and Tailwind, Rebass, Atomic, etc) is very much akin to learning CSS itself. Regardless of the tooling, you have to learn the properties and values, so why not get in the habit of writing them from the start?

Utility driven frontend isn’t going anywhere, and neither is component driven frontend. They ebb and flow, and if you can understand what’s underneath them, you’re in the best position to learn any other tools and languages.


This content originally appeared on @mdo and was authored by Mark Otto


Print Share Comment Cite Upload Translate Updates
APA

Mark Otto | Sciencx (2021-08-10T00:00:00+00:00) Learning CSS with utilities. Retrieved from https://www.scien.cx/2021/08/10/learning-css-with-utilities/

MLA
" » Learning CSS with utilities." Mark Otto | Sciencx - Tuesday August 10, 2021, https://www.scien.cx/2021/08/10/learning-css-with-utilities/
HARVARD
Mark Otto | Sciencx Tuesday August 10, 2021 » Learning CSS with utilities., viewed ,<https://www.scien.cx/2021/08/10/learning-css-with-utilities/>
VANCOUVER
Mark Otto | Sciencx - » Learning CSS with utilities. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/10/learning-css-with-utilities/
CHICAGO
" » Learning CSS with utilities." Mark Otto | Sciencx - Accessed . https://www.scien.cx/2021/08/10/learning-css-with-utilities/
IEEE
" » Learning CSS with utilities." Mark Otto | Sciencx [Online]. Available: https://www.scien.cx/2021/08/10/learning-css-with-utilities/. [Accessed: ]
rf:citation
» Learning CSS with utilities | Mark Otto | Sciencx | https://www.scien.cx/2021/08/10/learning-css-with-utilities/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.