CSS has a built-in clearfix

Posted . Visible to the public.

The need for clearfix hacks Show archive.org snapshot has been greatly reduced since we could layout with Flexbox or CSS Grid.

However, when you do need a clearfix, there's no reason to use a hack anymore. You can just give the clearing container display: flow-root Show archive.org snapshot .

This is supported by all browsers except IE11 Show archive.org snapshot .

Henning Koch
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2021-08-05 11:03)