问题
I have a table on my website where each table cell contains an image that is 138px X 138px. When I style <td> in CSS to have padding:0px; the table cell ends up with the size of 138px by 143px. I have not seen any reason as to why this is happening. Even when I do padding-bottom:-5px; the table remains at exactly the same size. What is happening!
The CSS:
td
{
width: auto;
height: auto;
padding: 0px;
}
回答1:
did you reset vertical-align to img tags ?
td img {
vertical-align:top; /* or bottom */
}
By defaut image stands on baseline wich explains that gap underneath.
来源:https://stackoverflow.com/questions/16926066/table-cell-padding-bottom-in-css-not-working