Question

how can i increase the space in this table "Row 1, cell 1"?

 <html>
 <table border="1">
 <tr>
 <td>Row 1, cell 1</td>
 <td>Row 1, cell 2</td>
 </tr>
 </table>  
 </html>

pls check here for the image: http://img227.imageshack.us/img227/6166/htmln.png

is this correct:

 <table border="1" td.my-cell { padding:100px; }>
<tr>
<td class="my-cell">Row 1, cell 1</td>
<td>Row 1, cell 2</td>
</tr>
</table>  
Was it helpful?

Solution

You can either use cellpadding or using css

.cellpadding {
   padding-left: 5px;
   padding-right: 5px;
}

<td class="cellpadding">Row 1, cell 1</td>

EDIT Your edited post is wrong....do this:

<table border="1">
    <tr>
        <td style="padding-left: 5px; padding-right: 5px;">Row 1, cell 1</td>
        <td>Row 1, cell 2</td>
    </tr>
</table>

OTHER TIPS

You can add a class to that specific cell and then use that class-name to apply css:

.larger {
height: 2em;
width: 4em;
padding: 2em;
}

<!-- rest of table -->
<td class="larger">Row 1, cell 1</td>
<!-- rest of table -->

Or you could use specific style-rules to apply a particular style:

tr td:first-child /* selects the first td within a tr */

Though this would apply to the first td of every row.

elaborate on "space"? you can add padding to the td if thats what you mean by "space"

table td { padding:5px; }

if you just want that cell bigger, add a calss

table td.my-cell { padding:5px; }

<td class="my-cell">Row 1, cell 1</td>

or do you mean

<td>Row 1,           cell1</td>

you can increase the space between words like this:

table td { word-spacing: 20px; /* adjust */ }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top