0

I want to have my text on the top-left in the 3rd cell.

Here is my example: http://jsfiddle.net/24nd5/

<table border="1" style="width: 100%;">
<tr>
    <td style="width: 15%;">
        lol lol lol lol lol
        lol lol lol lol lol
        lol lol lol lol lol
        lol lol lol lol lol
    </td>
    <td style="width: 3%;">

    </td>
    <td style="">
        Name
    </td>
</tr>
</table>
1

4 Answers 4

3

please add this inline CSS in your last <td>

vertical-align:top;

Here is the updated Demo link.

Demo

2
  • Hi Zak, you should checked the green mark, so other people know what answer is more accurate. otherwise more confusing for user who are looking for same kind of answer. Feb 24, 2014 at 9:22
  • and if you want to apply this only for 3rd cell, you can use pseudo-selector :last-child Feb 24, 2014 at 9:23
2

To make it more dynamic you can add:

table tr td:last-child  { vertical-align:top; }

or

table tr td:nth-child(3) { vertical-align:top; }

Fiddle here

Now if you add more rows each last cell (or third depends on which code you use from the above) wil have the text in the left top corner

Fiddle here

2

This is easy, just add vertical-align: top; to the <td> in cause.

1
<td style="text-align:left; vertical-align:top">
    Name
</td>

Not the answer you're looking for? Browse other questions tagged or ask your own question.