Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysterious Vertical Gap Between Divs

Tags:

html

css

There is a mysterious gap appearing between my header and footer. I took out the main content divs while investigating so I know it is not those to blame. Here is my website: http://classweb2.mccombs.utexas.edu/mis333k/msbcf555/TestSite/Default.aspx

I will share the stylesheet if requested, but it is long and I feel like the solution is something obvious that I have not thought of.

What I have tried:

  • Resetting the margins and padding
  • Making sure no line breaks or other divs are hiding between the real divs
like image 874
YepNamesJames Avatar asked Mar 04 '26 11:03

YepNamesJames


1 Answers

Your #header element has display:inline-block applied to it. Inline-block adds visible space between elements if there is any whitespace at all - even a single space character. I'm not why you've made it an inline-block, as it seems like a standard block level element. Remove that and the space should disappear.

There are other options as well, though I think this is the simplest. For more information on the "mysterious" spaces that inline-blocks creates, see here: http://css-tricks.com/fighting-the-space-between-inline-block-elements/

like image 195
Chris Herbert Avatar answered Mar 06 '26 00:03

Chris Herbert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!