D
dorayme
Ben C said:In Firefox 3 I get a 1px gap at the top and bottom of the image (but not
in Opera). Konqueror also has the gap. The image is the right width.
I get in FF2:
<http://dorayme.890m.com/alt/justPics/killy2_except_in_ff.png>
....
As for the other problem (which I don't know if you're seeing, but you
probably are) it's related to border-collapse: collapse.
If you add background: #ddd to the relatively positioned div and
background: pink to the table and then try with and without
border-collapse: collapse, you can see that when Firefox collapses a
border the border box of the table ends up outside the div. Making the
border on the td much bigger makes the problem clearer. Konqueror
(3.5.9) does the same.
Opera does what one might have expected-- the table doesn't overflow the
div it is in even with border-collapse: collapse. But actually I think
Opera is wrong and Firefox 3 and Konqueror are right: see CSS 2.1
17.6.2.
Without border-collapse: collapse they all behave the same-- the table
always leaves room for 2px around any cell borders. This is correct and
is because 2px is the border-spacing from the default stylesheet.
Of course if the outer div's top and bottom edges are in a different
position relative to the cell contents, our absolutely positioned img
container moves and that is the problem.
So the solution is OK provided you don't want collapsed borders.
What I am seeing in Safari 3 (latest Mac) and Opera, I am getting when
I remove border-collapse is image protruding top and bottom of its cell
and fixable by bumping up top:2px; and bottom:2px; to 4px each. I can't
say about FF 3.
Note that there is one other fishy thing we are relying on here which is
auto "left" for the absolutely positioned div around the img. It's
supposed to get positioned where it would have been if it had normal
flow, but browsers are free to guess at it.
Yes that looks fine-- but I never had the width problem in the first
place. Must have been fixed in Firefox 3. It's 3.0 I'm using.
But still the border-collapse problem. If the table has border-collapse:
collapse removed then it looks the same in all three.
Without border-collapse, adjustments of top and bottom from 1px to 4px
are needed at my end in Opera, Safari and FF2 to make them look more or
less kosher and the same.
I forget if I have said that if we carry on like this we should open a
business service to the pixel perfect brigade.... <g>