css - extra space in table cells with images html -
i have done plenty of searching both on stackoverflow , other sites , haven't found single solution has worked me yet. have attached screenshot of webpage see problem more clearly. if has tips or tricks have not been tried in code please let me know! have tried ideas former similar posts reason none of them working me. in advance.
html:
<table> <tr> <td><img border="0" alt="java" src="websitepics/med_high.png" width="568.5" height="296.5"></td> <td><img border="0" alt="python" src="websitepics/med_high.png" width="568.5" height="296.5"></td> <td><img border="0" alt="htmlcss" src="websitepics/med_high.png" width="568.5" height="296.5"></td> </tr> <tr> <td>text box describing level java</td> <td>text box describing level python</td> <td>text box describing level html/css</td> </tr> </table>
css:
table { border-collapse: collapse; border-spacing: 0px; } td { border: none; margin: 0; padding: 0; line-height: 0; display: block; font-size: 0; img { vertical-align: top; border: none; margin: 0; padding: 0; font-size:0; display: block; }
you have defined of .png
images 568.5 pixels, means table width 1704 px wide, wider width of page template.
you want images scale fit width of table cells.
you can setting width td
(33%) , letting images scale width of 100%.
note: built flexible/responsive layout, think might need.
table { border-collapse: collapse; border-spacing: 0px; width: 100%; border: 1px solid blue; } td { border: none; padding: 0; width: 33%; } img { display: block; width: 100%; } tr.labels td { background-color: beige; /* demo */ text-align: center; padding: 20px 0; } tr.images td { padding: 5px; /* demo if needed */ }
<table> <tr class="images"> <td> <img border="0" alt="java" src="http://placehold.it/568x296"> </td> <td> <img border="0" alt="python" src="http://placehold.it/568x296"> </td> <td> <img border="0" alt="htmlcss" src="http://placehold.it/568x296"> </td> </tr> <tr class="labels"> <td>text box describing level java</td> <td>text box describing level python</td> <td>text box describing level html/css</td> </tr> </table>
Comments
Post a Comment