Skip navigation
Currently Being Moderated

How to delete vertical space between two divs?

Oct 21, 2013 7:59 PM

I have a very simple page right now. Top div holds an image. The div below it holds another image. Both divs appear to be adding space to the bottom. I know other's have had this issue - yet when searching the forum I'm not finding anything. I've added 0 for padding and margins.... I"m out of patience. Want to go back to tables (but I won't let those divs beat me!) help please? http://www.duenorthdesign.com/christmas

 

I even added a container around everythign to see if that would help and it didn't. And my height dimensions match my images exactly.

 

OK, found the answer after nearly 3 hours. Due to  doctype html5 I used:

img {

vertical-align: bottom;

}

 

Just maybe this will help someone out there searching..... I went through about 50 attempts from reading posts before I stumbled on this one.

 
Replies
  • Currently Being Moderated
    Oct 21, 2013 9:56 PM   in reply to duenorth09

    After seeing your website it looks like you want the two images to join without any spacing. Correct? Why don't you try giving a negative value (of say -5px) to the top margin to #nav and see if this works for you?

     

    #nav{

    margin-top: -5px;

    }

     

    HTH

    Nithya

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 22, 2013 6:37 AM   in reply to duenorth09

    duenorth09 wrote:

     

    OK, found the answer after nearly 3 hours. Due to  doctype html5 I used:

    img {

    vertical-align: bottom;

    }

     

    Here's another (simpler) fix for the entire page...

     

    img {display:block;}

     

    What this does is remove the space for the text descender that is attached to display:inline elements (lower case j, g, q, etc).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points