0

How I could align my "message" text to the top because right now it's placed at the bottom.

demo: https://jsfiddle.net/WX58z/1096/

<div class="block">
   <label>Message</label>
   <textarea name="Message" rows="4" id="Message" style="width:300px;"> 
   </textarea>
</div>
0

5 Answers 5

4

It's simply the vertical-align property:

.block label {
    display: inline-block;
    width: 140px;
    text-align: right;
    vertical-align: top;
}
Sign up to request clarification or add additional context in comments.

Comments

1

Use the vertical-align property to change the alignment of the text:

.block label {
     display: inline-block; 
     width: 140px; 
     text-align: right; 
     vertical-align: top; /*HERE*/
}
<div class="block">
    <label>Name</label>
    <input type="Name" />
</div>
<div class="block">
    <label>Phone Number</label>
    <input type="text" />
</div>
<div class="block">
    <label>Email</label>
    <input type="text" />
</div>
<div class="block">
    <label>Message</label>
<textarea name="Message" rows="4" id="Message2" style="width:300px;"></textarea>
</div>

Comments

1
.block label {
     display: inline-block; width: 140px; text-align: right; vertical-align:top;
}

Use vertical-align: top;

Comments

1

Add float:left; to your label tag: fiddle

1 Comment

how can i also have a bit of gap between each labels?
1

Change your css to this:

.block label {
     display: inline-block; width: 140px; text-align: right; vertical-align:top;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.