Ya know, for a site called “CSS-Tricks” that I’ve run for well over a decade, it’s a little funny we’ve never done a book under that name. I’ve written a book about WordPress and SVG, but never CSS!
Well, allow me to change that. I’ve been working on a “book” called The Greatest CSS Tricks Vol. I, as my attempt to stay true to this site’s name! The big idea is to make it like a coffee-table book for CSS, where each chapter is totally independent and talks about one literal CSS trick that I’ve found to be exceptionally clever and useful — a book about quite literally the best CSS tricks I’ve come across over the years.
I quoted the word “book” above because this is the loosest possible definition of a book. I have not yet made it into an eBook format. I have not even considered printing it yet (although there is a “full book” URL available with the whole book together for printing and print-to-PDFing). This book exists as URLs which are essentially fancy blog posts grouped together. I’m also calling it Volume I as there are already ideas for another one!
Some chapters are broadly known concepts that I’ve written up. But many of the chapters are based on ideas that can be traced back to individual people and I always try to credit them directly.
Here’s the chapter list so far:
- Pin Scrolling to Bottom
- Scroll Animation
- Yellow Flash
- Shape Morphing
- Flexible Grids
- Border Triangles
- Scroll Indicator
- Boxy Buttons
- Self-Drawing Shapes
- Perfect Font Fallbacks
- Scroll Shadows
- Editable Style Blocks
- Draggable Elements
- Hard Stop Gradients
I say so far because I might add a few others, rearrange them and such. It could still use a healthy bit of editing. But I think the bulk of the value of the book is already there.
Value? I think there is! While it’s fun to learn some CSS trickery, I think there is value beyond the tricks themselves. Tricks help you see how CSS works at a deeper level. When you understand the trick, you’re seeing how that part of CSS works through a new lens and it helps you be more in tune with the nature of that CSS. It will help you reach for those CSS properties more intuitively when you know what they are capable of.
In another sense, it’s like taking a walk with weights in your backpack. You do it intentionally so it feels easier to walk when they’re removed. The tricks are like mental weights. They make writing less-tricky CSS feel easier.