HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Learn how to clear floats with the "clearfix" hack
Elements after a floating element will flow around it. Use the "clearfix" hack to fix the problem:
If an element is taller than the element containing it, and it is floated, it will overflow outside of its container.
Then we can add overflow: auto;
to the containing element to fix
this problem:
The overflow:auto clearfix works well as long as you are able to keep control of your margins and padding (else you might see scrollbars). The new, modern clearfix hack however, is safer to use, and the following code is used for most webpages:
Tip: Learn more about floats in our CSS Float Tutorial.