CSS materials
Last updated ago - September 30, 2023Free
Paid
Additional content
Tips compilations
- Fireship - 10 CSS Pro Tips - Code this, NOT that!
- Fireship - 3 More Life-Changing CSS Tips
- Defensive CSS - practical tips that helps in building “bullet-proof” UI interfaces
- CSS Reference - visual guide for the most popular properties
- CSS Tricks - My Dumbest CSS Mistakes
- Josh W. Comeau - Secret Mechanisms of CSS [learn the “hidden” fundamentals that nobody told you about.]
Takeaways from CSS for JavaScript Developers:
Flex Basis / Flex Grow / Flex Shrink Flex Shorthand
Core concepts
- Writing CSS In 2023: Is It Any Different Than A Few Years Ago?
- Josh W. Comeau - The Surprising Truth About Pixels and Accessibility
- Josh W. Comeau - What The Heck, z-index?? [how to manage the positioning of elements]
Selectors
:has()
- Web Dev Simplified - learn about the :has selector
- Kevin Powell - :has() opens up new possibilities with CSS
- Kevin Powell - Exploring :has() and New CSS Possibilities
Responsive
- You Probably Don’t Need Media Queries Anymore - how to build truly dynamic responsive websites
- Web Dev Simplified - Top 10 Advanced CSS Responsive Design Concepts You Should Know
Layouts
- Utopia - learn fluid responsive design
- Web Dev Simplified - How To Create Skeleton Loading Animation With CSS
- Web Dev Simplified - How To Create Custom Scrollbar In CSS
- Web Dev Simplified - How To Create Advanced CSS Dropdown Menus
- Web Dev Simplified - How To Create Animated CSS Cards
- Web Dev Simplified - How To Create An Animated Image Carousel With CSS/JavaScript
- Web Dev Simplified - Create CSS Parallax
- Web Dev Simplified - Limit lines of text with CSS
- Web Dev Simplified - How To Create This Unbelievable CSS Scroll Animation
- Web Dev Simplified - CSS Anchor Is The Best New CSS Feature Since Flexbox
- Beyond Fireship - Subtle, yet Beautiful Scroll Animations
Common mistakes
- Web Dev Simplified - Are You Making These CSS Height Mistakes?
- Kevin Powell - CSS gap is NOT a replacement for margins
- Kevin Powell - Please NEVER do this in your CSS
- Kevin Powell - The problems with viewport units
- Kevin Powell - 5 common beginner CSS mistakes
- Kevin Powell - My dumbest CSS mistakes and how I debug them
Debugging
Tailwind CSS
Dynamic variants without using third-party library (like CVA or tw.classed)
Atomic CSS - pros, cons and will it replace BEM?
The most important highlights
Difference between a single class (BEM approach) and the atomic approach (tailwind):
The classname “tells” you what kind of component it is (e.g., whether it’s a card or a container), but it doesn’t give you implementation details (i.e., what styles it’s made up of), while Tailwind gives you the details of the implementation, but doesn’t illustrate what the component represents.
Cons of Tailwind
- Debugging in the browser because there isn't a single specific class (this can be circumvented by using the devtools of a specific framework and searching by components). Additionally, dynamically adding a new attribute is difficult (this can be circumvented using external devtools like https://tailscan.com/, https://www.inspectflow.io/, or https://devtoolsfortailwind.com/).
- Reading the classes alone doesn't provide specific information compared to regular CSS.
- It won't be suitable everywhere. For example, in a project where only HTML, CSS, and JS are used, Tailwind will be a poor solution.
- Since v3, the addition of dynamic classes has been significantly limited, e.g., bg-{color}-500
won't work anymore (this can be bypassed by loading the entire Tailwind via CDN, which significantly increases the project bundle).
- Tailwind users tend to write non-semantic HTML - this can be prevented by using a11y analysis tools.
An alternative approach to Tailwind towards type safety - for those who want to be sure there will be no typos and want the styles to be modular and extensible as in CSS Modules.
Drawbacks - the syntax isn’t as convenient, but it’s a matter of getting used to.
Other
- Going beyond CSS variables with custom properties
- Tailwind CSS vs Vanilla CSS + BEM - which approach is better?
- Josh W. Comeau - You Don’t Need A UI Framework (how to build ui without using the third-party component library?)
- Theo - ping.gg - Tailwind isn’t Bootstrap (a short video showing differences between CSS solutions)