问题
I have an 600x90 picture and I want a table cell with exactly 600x90 dimensions.
But I tried overflow:hidden and some other solution on the net, but it still expands the table cell for a couple of pictures.
The best I could get so far is 600x93 but it leaves 3 empty pixels at the bottom, which looks very awkward!
Can someone help me on finding a solution?
回答1:
images by default have
display:inline
which in most browsers adds 3-5 pixels to it's height.
Try setting the css for the picture like this:
table.myTable td.withImage img { display:block; }
and see if it works.
回答2:
I've seen this happen in some browsers where the default image display type is inline, and it sits above some imaginary line. Try adding display:block to your image class.
If this doesn't help, let us know if its a cross-browser problem or just FF/IE/whatever. Also an example could help.
来源:https://stackoverflow.com/questions/5791033/image-expands-the-table-cell