Arjel
Arjel

Reputation: 469

How will I align the label of a text area to top?

I do have a table data as shown below:

<td>
    <label for="title">Title : </label>
    <textarea rows="5" id="title" name="title"></textarea>
</td>

the default location for the label is at the bottom. How will I place the label aligned with the top of the text area?

Upvotes: 32

Views: 63243

Answers (3)

Kiur Jullis
Kiur Jullis

Reputation: 19

Use br tag.

<td>
    <label for="title">Title : </label>
    <br>
    <textarea rows="5" id="title" name="title"></textarea>
</td>

Upvotes: 0

SVS
SVS

Reputation: 4275

@Bazmegakapa Great answer! We can also do it this way

label{display:block; float:left;}​

fiddle demo: http://jsfiddle.net/kaMqg/1/

Upvotes: 2

kapa
kapa

Reputation: 78671

With the following CSS:

​textarea { vertical-align: top; }​

Upvotes: 68

Related Questions