How to clear floats

Time:2020-8-2

1、 Why clear floats
When the child element is set to float, the height of the parent element will collapse to 0, affecting the page layout

How to clear floating
Add pseudo class before and after the parent element to support the parent element to use the clear:both To clear the float

.clear-float:after,.clear-float:before{
    Content: '// fill in the blank content;
    display:block;
    clear:both
}

Recommended Today

ASP.NET Example of core MVC getting the parameters of the request

preface An HTTP request is a standard IO operation. The request is I, which is the input; the responsive o is the output. Any web development framework is actually doing these two things Accept the request and parse to get the parameters Render according to the parameters and output the response content So let’s learn […]