Table Cell padding-bottom in CSS not working

老子叫甜甜 提交于 2019-12-12 19:26:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!