Skip to content

Comment on Learn CSS Layoutparent

Comments

For the clearfix can't you just use `clear:right` or `clear:both`?

Not if you use it on the container itself, since it would apply to the interaction with floated elements that come before the one you use clear on - but here you open the container tag first, and then come the floats.

You could use clear on an element that comes after the floated elements, but before the container is closed, though. (you can also use the ::after pseudo element for this, maybe even in combination with ::last-child or something)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.