Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

textarea label vertical-align: middle

I'm trying to align the label for this text area in the middle of the text box, but it just isn't working. The output looks something like this:

          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx      
          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
          xxxxxxxxxxxxxxxxxxxxxxxxxxxxx    
Synopsis: xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Here's the code I've been trying. TY!

<style>
label textarea{
 vertical-align: middle;
}
</style>

<label>Synopsis: <textarea style="border: none" rows="7" cols="60">$v_Synopsis</textarea></label> 
like image 417
Mike Avatar asked Oct 22 '13 16:10

Mike


People also ask

How do I vertically align text in textarea?

For vertical alignment, set the parent element's width / height to 100% and add display: table . Then for the child element, change the display to table-cell and add vertical-align: middle .

How to center a label in HTML?

The <center> tag in HTML is used to set the alignment of text into the center.

How to vertically align text?

Center the text vertically between the top and bottom margins. Select the text that you want to center. in the Page Setup group, and then click the Layout tab. In the Vertical alignment box, click Center.


1 Answers

CODEPEN DEMO

HTML

 <div>
  <label for="textarea">Textarea:</label>
  <textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
</div>

CSS

label,
textarea{
  display:inline-block;
  vertical-align:middle;

}
like image 140
Paulie_D Avatar answered Sep 20 '22 11:09

Paulie_D