0

excuse me if my question will be naive but i'm just learning some basic HTML and CSS from home.

I'm trying to understand how the overflow works. I've read a lot online but still i can't get a firm grip on it...in the specific why should i use

overflow: hidden;

in order to get my div to expand on top and get rid of the white space?

BEFORE: div not expanding properly

AFTER: div expanding on top

Here you can see my code which is almost the same: https://codepen.io/Code_Cafe/pen/EemVRz

My answer has been marked as "answered". The fact is that I've read about collapsing margins but i didn't understand the explanation and most of all, WHY overflow:hidden is the solution...

Many thanks guys!

Bill Hileman
  • 2,798
  • 2
  • 17
  • 24
Unearthly
  • 121
  • 6
  • Hi, welcome to SO! Will you please share your html and css code snippet? – Vinit Desai Sep 03 '18 at 08:26
  • a lot of reasons: overflow clear float, change the baseline of inline-block, etc etc ... share your code to get the answer – Temani Afif Sep 03 '18 at 08:56
  • I've uploaded the code, sorry! – Unearthly Sep 03 '18 at 09:14
  • there is nothing in your code similar to what we see in the image – Temani Afif Sep 03 '18 at 09:24
  • Nothing? I don't what are you looking at, but the code is almost the same except for the navbar which i have removed for simplicity. If in the code you type overflow:hidden; in the .container then you will notice that it changes and i can't explain why... – Unearthly Sep 03 '18 at 09:52

0 Answers0