Padding inside table cell despite td{padding:0}

Welcome to ScriptMode
Yokesh
Posts: 63
Joined: Sat Dec 05, 2015 1:49 pm

Padding inside table cell despite td{padding:0}

Postby Yokesh » Thu Mar 03, 2016 1:32 pm

I'm having this quite annoying bug for a while now.. The problem is quite simple, there is this huge padding appearing on the top and bottom of a table cell when i place an object (in this case, image) in it.

What I am trying to do is place different objects in a Grid set up as table in HTML so that's why you will see all those extra cells. initial width and height of table and cells is known, I just specify col/row span of the cell in which the object will be placed based on object's width/height.

I have searched and applied many solutions like cellspacing,cellpadding = 0, padding: 0, img's display block but nothing seems to be working here.

td{border:1px solid black; padding:0}
<table style="width:600pt; height:800pt; table-layout: fixed;" cellspacing="0" cellpadding="0">
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td colspan="30" ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td rowspan="15" colspan="15" ><img style="width:298pt; height:292pt;" src="http://i.imgur.com/mrxsiZ3.jpg"/>
</td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td><td ></td></tr>
<tr>
<td rowspan="18" colspan="30" ></td></tr>
</table >
Img is placed in 8th row and 8th column of the grid but it slides quite a lot way down in the cell because of the padding. Inspecting the cell in browser will clear out the problem.

Return to “General”

Who is online

Users browsing this forum: No registered users and 7 guests