AlexRichardson Posted November 11, 2007 Share Posted November 11, 2007 So I am trying to place two divs inside a table. When I do, there is a space between them only for internet explorer. Check out the pic showing the problem <table> <tr> <td> <div> <img src="slices/a-3.jpg"> </div> <div> <img src="slices/a-2.jpg"> </div> </td> </tr> </table> the page: http://www.k-state.edu/sctd/theatre/divsintable.htm Link to comment Share on other sites More sharing options...
Ingolme Posted November 11, 2007 Share Posted November 11, 2007 Try this in the <head> of the document:<style type="text/css">img {margin-bottom: 0px;}</style>For some reason Internet Explorer puts a margin under the images. Link to comment Share on other sites More sharing options...
AlexRichardson Posted November 11, 2007 Author Share Posted November 11, 2007 That still didn't fix it. I've narrowed down the problem. It has nothing to do with tables. It is simply two divs are having a gap between them on Internet Explorer. Here is the updated test link and code.Link: http://www.k-state.edu/sctd/theatre/divsintabletest2.htm <div style="style1"> <img src="slices/a-3.jpg" alt="Link to KSU page"></div><div style="style1"><img src="slices/a-2.jpg" alt="Link to SCTD portal"> </div> Link to comment Share on other sites More sharing options...
Ingolme Posted November 11, 2007 Share Posted November 11, 2007 Try putting borders around the <div> to see whether the extra space is inside or outside.div {border: 1px solid red;} Link to comment Share on other sites More sharing options...
AlexRichardson Posted November 11, 2007 Author Share Posted November 11, 2007 Resolved.Old code <div> why is there</div><div> a gap between these divs.</div> new code <div>because ie reads the return carriage</div><div>content must be squeezed between div tags</div> Link to comment Share on other sites More sharing options...
jesh Posted November 12, 2007 Share Posted November 12, 2007 Resolved.Old code<div> why is there</div><div> a gap between these divs.</div> new code <div>because ie reads the return carriage</div><div>content must be squeezed between div tags</div> Just for clarification for other readers, the problem isn't necessarily with the carriage returns. The problem, really, is with the carriage returns where there are images. The above code will render exactly the same in IE whereas the following will not:<div> <img src="http://www.w3schools.com/images/w3default80.jpg" /></div><div> <img src="http://www.w3schools.com/images/w3default80.jpg" /></div> <div><img src="http://www.w3schools.com/images/w3default80.jpg" /></div><div><img src="http://www.w3schools.com/images/w3default80.jpg" /></div> One of the ways to fix that is to either float the image (which makes the display "block") or explicitly setting the display to block. This will render as if there aren't any carriage returns: <div> <img style="display:block;" src="http://www.w3schools.com/images/w3default80.jpg" /></div><div> <img style="display:block;" src="http://www.w3schools.com/images/w3default80.jpg" /></div> Also keep in mind that this really only happens in IE. Link to comment Share on other sites More sharing options...
midnite Posted November 15, 2007 Share Posted November 15, 2007 http://www.k-state.edu/sctd/theatre/divsintable.htmwhy your page, without the <link rel="shortcut icon" href="/favicon.ico" /> stuff, can also display a favicon? so strange?? Link to comment Share on other sites More sharing options...
Ingolme Posted November 15, 2007 Share Posted November 15, 2007 If favicon.ico is placed in the top level of a server that allows it, the favicon will show on all pages of the server. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 15, 2007 Share Posted November 15, 2007 new code<div>because ie reads the return carriage</div><div>content must be squeezed between div tags</div> Yeah, that's a bug in IE. Browsers are supposed to ignore whitespace in HTML, IE doesn't always do that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.