Sollicitatiegesprek voor de functie Front End Engineer



What situation arises when you have a parent div and all it contains is a pair of floating divs? And how can you remedy the situation.


Antwoorden op sollicitatievragen

3 antwoorden



ramonlechuga op


Yes, overflow:hidden is the best way to do it. Another way is to use a technique called clearfix using psuedo-element :after

Vishal op


When a div contains only floating elements it thinks nothing is inside so it will have a height of 0 if none is specified. This is known as a floating div clearing problem since the floating divs are not being cleared inside the parent div. There are a couple solutions, you can add an extra empty div after the floating divs with style clear:both to clear the floating divs. Only problem is this adds extra markup. Alternatively, there are some known CSS hacks such as setting the width:100% and the overflow:auto on the parent div.

Anoniem op

Voeg antwoorden of opmerkingen toe

Meld u aan of registreer u om hier een opmerking over te maken.