The problem with clear

Code:

   

Why the height of right becomes 100px instead of 30px .

Aug.06,2021

this example I have written about parsing before, you can see, it should be helpful click to see


  1. clear can clear not only the floats of adjacent elements, but also the floats of non-adjacent elements
  2. clearing the element float solves the collapse problem of the parent element, and the height of the parent element after clearing the float is determined by the maximum height of the cleared floating element.

you can get the height of the parent element of these two floating elements, and you'll see if you think about it, this is its feature, or else look at the official documentation.

Menu