There is a div (main) block with a fixed height, there are also several blocks that have their own height and width. As soon as the fixed height of the main div is cleared, it disappears. Shouldn't it stretch against the longest inner element?

  • So it affects some styles. For example, float of some of the blocks - Deonis
  • Thanks, really float. But how can I refuse it if I need to position elements? - Radik Kamalov
  • Why refuse? Not on your topic, but just recently made an example . Notice the CSS rule #wrapper: after {...} . Comment it out and run (RUN). You will see what will happen to the block (he is with the border). Looks like your situation? - Deonis
  • It looks like the block disappears. But I did not understand what to do. I also registered: after in my code, result 0 - Radik Kamalov
  • @ Radik Kamalov, just registering is not the focus)) In general, for beginners there is a simpler way: add an element after the float, some element, ala: <p style = "clear: left / right / both"> </ p> Or read about the pseudo-element : after - Deonis

1 answer 1

Google on "clearfix", "stream clearing". There are several ways, it is better to know more to apply the necessary