I have a very similar question to the one asked at CSS width/height of IMG and TD. The main difference being, that the solution proposed was to define the table dimensions in the css. This solution won't work for me because every td is different.
The html for this was generated by Adobe when we made an image using slices. So each table cell is defined to be the exact same size as the image slice it contains. The image is very complex so we cannot possibly do it by hand.
When we load the Adobe-generated html into a browser, it works correctly, however, when we integrate it into our existing project the td elements change dimension. Inspecting them using development tools shows there is both height and width added, but checking all the style elements (including inherited elements), we cannot see any padding, margins or borders. Even if we explicitly define the td to the same width and height as the image it contains, we still get the extra space.
Here are the styles that Firebug tells us are affecting the td. They are:
element.style {
visibility: visible;
margin: 0;
padding: 0;
}
body {
font-size: 12px;
color: #3c1a1a;
font-family: Georgia;
}
.slide {
list-style: disc outside none;
}
.TL {
border-collapse: separate;
background: none repeat scroll 0 0 transparent;
border: 0 none;
border-spacing: 0;
}
And here are the styles affecting the img (repeating a lot of the td styles because of inheritance):
element.style {
visibility: visible;
}
body {
font-size: 12px;
font-family: Georgia;
color: #3c1a1a;
}
.slide {
list-style: disc outside none;
.TL {
background: none repeat scroll 0 0 transparent;
border: 0 none;
padding: 0;
border-collapse: separate;
}
Here is a sample of the Adobe-generated html:
<table class="override" id="Table_02" width="470" height="628" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="15" style="padding: 0px; margin: 0px;">
<img class="TL" src="Images/Map1/map/Interactive-Map_01.gif" width="449" height="56" alt="Location of Cairo">
</td>
<td>
<img class="TL" src="Images/Map1/map/spacer.gif" width="1" height="56" alt="just a spacer">
</td>
</tr>
I cannot for the life of me see how these rules could be adding the extra dimensions, but they are undeniably there, and our cool interactive map has big gaps in it. Can anyone suggest why this extra space might be adding itself to our td elements?
Thanks so much in advance. Kate