tags:

views:

66

answers:

3

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>  
A: 

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 */ }

Ross
yes the cell bigger...
tintincute
A: 

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.

David Thomas
So would the down-vote care to explain the down-vote?
David Thomas
+2  A: 

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>
The Elite Gentleman
this doesn't work...:-(
tintincute
what doesn't work? cellpadding or the example I put?
The Elite Gentleman
the example you put...pls see my edited question above
tintincute
i just found out that it's the width...
tintincute
See my updated post to your updated example.
The Elite Gentleman
this is great help The Elite Gentleman ;-) Can I also use padding-bottom here?
tintincute
yes, you can even use `padding-top`.
The Elite Gentleman
thanks a lot The Elite Gentleman ;-) now it's working...
tintincute