As a perennial CSS newbie (who kind of had skills a decade ago) I appreciated this short article from Robin Rendle about when (translation: how little) you should use the float: left
that was so common when I last really did CSS.
To summarize, you can (and should) keep using float
for what it is originally designed for: embedding small things like images inside of text which flows naturally around them. But all the other layout used people put them to for years? Skip it and that annoying clearfix
stuff we all had to do.
The most interesting thing from the article—which Robin also seemed surprised by—is that haven’t actually need to do that clearfix
stuff for a while, all because of a little property on display
called flow-root
. To learn just how that works, you’ll have to click through ?
Visit css-tricks.com →
Keep reading the article at WPShout. The article was originally written by David Hayes on 2021-02-17 11:50:18.
The article was hand-picked and curated for you by the Editorial Team of WP Archives.