Solved

get label and textbox to align vertically

Posted on 2009-07-15
3
750 Views
Last Modified: 2012-05-07
How do I get the Label text and the Text Box to align vertically at their middles?

See screenshot

thx!
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddToCart.ascx.cs" Inherits="Spatz.controls.AddToCart" %>
 

<link rel="Stylesheet" href="../css/addtocart.css" type="text/css" />
 

<div id="addtocartdiv">
 

<div id="addtocarbgdiv">

<asp:Image ID="addtocartimage" runat="server" ImageUrl="~/img/addtocart_background.gif" />

</div>
 

<div id="quantitydiv">

<asp:Label ID="LabelQuantity" runat="server" Text="Quantity:"></asp:Label>&nbsp;&nbsp;&nbsp;

<asp:TextBox ID="TextBoxQuantity" runat="server" Width="35px"></asp:TextBox>

</div>
 

<div id="addtocartbuttondiv">

<asp:Image ID="addtocartbutton" runat="server" ImageUrl="~/img/addtocart_button.jpg" />

</div>
 

</div>

Open in new window

vertalign.jpg
0
Comment
Question by:knowlton
  • 2
3 Comments
 
LVL 5

Author Comment

by:knowlton
ID: 24864447
addtocart.css file:
#addtocartdiv

{    

 

}
 

#addtocarbgdiv

{

    position:relative;

}
 

#quantitydiv

{

    vertical-align:top;

    position:absolute;

    width:120px;

    margin: 0 auto;

    top:20px;

    left:20px;

}
 

#addtocartbuttondiv

{

    position:absolute;

    top:50px;

    left:20px;

}

Open in new window

0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24864730
add this class to your css
.aligncenter
{
    vertical-align:middle;
}
then
<div id="quantitydiv">
<asp:Label ID="LabelQuantity" CssClass="aligncenter" runat="server" Text="Quantity:"></asp:Label>&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBoxQuantity" CssClass="aligncenter" runat="server" Width="35px"></asp:TextBox>
</div>
0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 31604007
thx
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now