Jump to content

divs in table show up wrong in IE


AlexRichardson

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...