Reputation: 14931
So I got this snippet: (this is the jsfiddle)
<div><label style="height: 58px;">Label</label>
<textarea>11111</textarea>
</div>
<br/>
<br/>
<br/>
<br/>
<div><label style="height: 158px;">Label</label>
<textarea style="height:199px">11111</textarea>
</div>
this is the css
label{
display:inline-block;
background-color: grey;
}
This is the sad result:
I want the label to be in the center of the textarea field. Someone got a clue what is going on here?
Upvotes: 2
Views: 1970
Reputation: 27614
Use vertical-align
CSS property to set middle value to solve this problem.
<div>
<label>Label</label>
<textarea>11111</textarea>
</div>
<br/>
<br/>
<br/>
<br/>
<div>
<label>Label</label>
<textarea style="height:199px;">11111</textarea>
</div>
textarea{
vertical-align: middle;
}
Upvotes: 2
Reputation: 10270
You have to set the vertical-align: middle
property for the textarea (or for any element for which you want to specify a label - e.g. works for multiple select as well).
Upvotes: 5