[html] html cellpadding the left side of a cell

I want to pad my text in a cells on the right side with additional space .

I don't use css style sheets .

this is my code <table border="1" CELLPADDING="5"> on right size for example I want 10.

Thanks .

This question is related to html

The answer is


I choose to use both methods. Cellpadding on the table as a fallback in case the inline style doesn't stick and inline style for most clients.

_x000D_
_x000D_
<table cellpadding="5">_x000D_
  <tr>_x000D_
    <td style='padding:5px 10px 5px 5px'>Content</td>_x000D_
    <td style='padding:5px 10px 5px 5px'>Content</td>_x000D_
  </tr>_x000D_
</table>
_x000D_
_x000D_
_x000D_


I use inline css all the time BECAUSE.... I want absolute control of the design and place different things aligned differently from cell to cell.

It is not hard to understand...

Anyway, I just put something like this inside my tag:

style='padding:5px 10px 5px 5px'

Where the order represents top, right, bottom and left.


I would suggest using inline CSS styling.

<table border="1" style="padding-right: 10px;">
<tr>
<td>Content</td>
</tr>
</table>

or

<table border="1">
<tr style="padding-right: 10px;">
<td>Content</td>
</tr>
</table>

or

<table border="1">
<tr>
<td style="padding-right: 10px;">Content</td>
</tr>
</table>

I don't quite follow what you need, but this is what I would do, assuming I understand you needs.


Well, as suggested by Hellfire you can use td width or you could place an element in the td and adjust its width. We could not use

CSS property Padding

as in Microsoft Outlook padding does not work. So what I had to do is,

<table>
    <tr>
        <td><span style="display: inline-block; width: 40px;"></span><span>Content<span></td>
        <td>Content</td>
    </tr>
</table>

With this you can adjust right and left spacing. For top and bottom spacing you could use td's height property. Like,

 <table>
        <tr>
            <td style="vertical-align: top; height: 100px;">Content</td>
            <td>Content</td>
        </tr>
    </table>

This will increase bottom space.

Hope it will work for you guys. :)


I recently had to do this to create half decent looking emails for an email client that did not support the CSS necessary. For an HTML only solution I use a wrapping table to provide the padding.

_x000D_
_x000D_
<table border="1" cellspacing="0" cellpadding="0">_x000D_
    <tr><td height="5" colspan="3"></td></tr>_x000D_
    <tr>_x000D_
        <td width="5"></td>_x000D_
        <td>_x000D_
            This cells padding matches what you want._x000D_
            <ul>_x000D_
                <li>5px Left, Top, Bottom padding</li>_x000D_
                <li>10px on the right</li>_x000D_
            </ul>    _x000D_
            You can then put your table inside this_x000D_
            cell with no spacing or padding set.                    _x000D_
        </td>_x000D_
        <td width="10"></td>_x000D_
    </tr>_x000D_
    <tr><td height="5" colspan="3"></td></tr>_x000D_
</table>
_x000D_
_x000D_
_x000D_

As of 2017 you would only do this for old email client support, it's pretty overkill.