I was playing around with a floated div example, where I have a floated container and some floated child divs except one non-floated child
You can see the example on;
Now I wanted to understand the behavior or rendering for this non-floated child div…
2 questions:
-
Could you please explain how it renders currently and what difference does it make if I have it coded after all the child divs (i.e. it is the last child element)
-
Also will it have any impact on the non-floated child if I make the container as overflow:hidden ?
Answer 1
At the moment the un-floated
divright at the top with the red border is displayingblockso it spans the whole width of it’s containingdiv. It is unaffected by the otherdivsin the containing elementIf you move it to the last position in the containing
divthe other floateddivsdo affect the un-floated one so you need toclear: both;(which clears the float and places the un-floateddivunder the floateddivs) withCSS, otherwise any text contained within the un-floated one will be floated to the left and then would proceed to wrap around the floated elements (it doesn’t do this at the moment because the text isn’t long enough). Unless that’s what you are trying to achieve?Answer 2
It shouldn’t make any difference as nothing is actually overflowing the containing
divwhich would be set tooverflow: hidden;Hope this helps