Align Textboxes on a form

Last post 11-07-2009 12:03 PM by DarrellNorton. 1 replies.

Sort Posts:

  • Align Textboxes on a form

    11-07-2009, 9:16 AM
    • Member
      1 point Member
    • ranswrt
    • Member since 10-22-2009, 1:17 PM
    • Posts 8

    I have the following code for a form:

    <form method="post" action="downloaddemo.aspx">

     <fieldset id="registration">

     <h3>Fill out Registration Form:</h3>

     <p><asp:ValidationSummary ID="ValidationSummary1" runat="server"

    HeaderText

    ="There were errors on the page:" />

     <label>First Name:</label><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>  <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"

     ControlToValidate="txtFirstName"

     ErrorMessage="First name required."> *</asp:RequiredFieldValidator><br />

     <label>Last Name:</label><asp:TextBox ID="txtLastName" runat="server"></asp:TextBox>

     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"

     ControlToValidate="txtLastName"

    <ErrorMessage="Last name required."> *</asp:RequiredFieldValidator>br />

     <label>email:</label><asp:TextBox ID="txtemail" runat="server"></asp:TextBox>

     <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"

     ControlToValidate="txtemail"

     ErrorMessage="email required."> *</asp:RequiredFieldValidator><br /> <p><asp:Button id ="btnDownloadDemo" runat="Server" Text="Download Demo" /></p></fieldset >

     </form>

    I would like to get the textboxes to align vertically on the form.  How do I use CSS to accomplish this?

    Thanks

     

  • Re: Align Textboxes on a form

    11-07-2009, 12:03 PM
    Answer
    • All-Star
      54,716 point All-Star
    • DarrellNorton
    • Member since 04-04-2003, 11:49 AM
    • VA, USA
    • Posts 6,587
    • Moderator
      TrustedFriends-MVPs

    At least you already have a fieldset tag.  See these 2 articles for help:

    http://www.pixy.cz/blogg/clanky/css-fieldsetandlabels.html

    http://www.developeers.net/2008/11/turning-aspnet-panel-into-fieldset.html


    The first one is the pure CSS solution.

    Darrell Norton, MVP
    Darrell Norton's Blog


    Please mark this post as answered if it helped you!
Page 1 of 1 (2 items)