?
Solved

get label and textbox to align vertically

Posted on 2009-07-15
3
Medium Priority
?
757 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:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Author Comment

by:Tom 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 2000 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:Tom Knowlton
ID: 31604007
thx
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

801 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