*Vertical* centering in CSS with margin: auto
Published on in CSS and CSS for JS Devs course
margin: auto
is not only for horizontal centering.
margin: auto
Published on in CSS and CSS for JS Devs course
margin: auto
is not only for horizontal centering.
position: fixed
breaks if any of its ancestors uses transform
Published on in CSS and CSS for JS Devs course
Or perspective
or filter
.
This can easily cause confusing bugs.
Published on in CSS and CSS for JS Devs course
height
and width
work somewhat differently in CSS.
height
looks "down" the tree
whereas width
looks "up" the tree.
Published on in CSS and CSS for JS Devs course
Block elements stack on top of each other. Inline elements are placed side by side.
Published on in CSS and CSS for JS Devs course
Last updated on
It's frustrating when a CSS declaration is technically valid (not crossed out in the browser's DevTools) but has no effect for some reason. Firefox DevTools can often tell you why and also how to potentially fix those issues! (Update: Chrome 108+ can too.)