hh54188
hh54188

Reputation: 15636

How to let the character in a table stay at the top

Look at this code:

<table width="100%">
    <tbody>
        <tr>
            <td  style="width:20%;"><span>hello world</span></td>
            <td  style="width:60%;">
                <textarea style="width:100%;height:200px;"></textarea>
             </td>
             <td>
             </td>
         </tr>    
    </tbody>
</table>

The "hello world" in the left <td>

just stays at the middle (sometimes even at the bottom),

so what attribute should I set to let the word stay at the top of the table? Here is an online example at JSFiddle

Upvotes: 0

Views: 57

Answers (2)

mohana rao
mohana rao

Reputation: 429

<table width="100%">
            <tbody>
                <tr>
                    <td  style="width:20%;" valign="top"><span>hello world</span></td>
                    <td  style="width:60%;">
                        <textarea style="width:100%;height:200px;"></textarea>
                    </td>
                    <td>
                    </td>
                </tr>

            </tbody>
        </table>

Upvotes: 0

Kyle
Kyle

Reputation: 67204

Just add vertical-align: top; to the td style.

See it here.

Upvotes: 1

Related Questions