How do I align a label and a textarea?
You need to put them both in some container element and then apply the alignment on it.
For example:
.formfield * { vertical-align: middle;}
<p class="formfield"> <label for="textarea">Label for textarea</label> <textarea id="textarea" rows="5">Textarea</textarea></p>
- Set the
height
of your label to the sameheight
as the multiline textbox. Add the cssClass
.alignTop{vertical-align: middle;}
for the label control.<p> <asp:Label ID="DescriptionLabel" runat="server" Text="Description: " Width="70px" Height="200px" CssClass="alignTop"></asp:Label> <asp:Textbox id="DescriptionTextbox" runat="server" Width="400px" Height="200px" TextMode="MultiLine"></asp:Textbox> <asp:RequiredFieldValidator id="DescriptionRequiredFieldValidator" runat="server" ForeColor="Red" ControlToValidate="DescriptionTextbox" ErrorMessage="Description is a required field."> </asp:RequiredFieldValidator>