Many thanks!!!
Main Topics
Browse All TopicsGreetings all
I am busy looking at how to position Asp Textboxes and Asp Labels within my page:
1. With regard to position them underneath each other, I could do one of two things (the only ways that I
know) - see Snippet 1 & 2. Are these ok? Are there others?
2. With positioning on the same line, I'm not sure how I get the spacing right, unless I used a style property
and say left=123px". This doesn't soudn like the best option! Are there btter ways?
In advance, thanks!!
allanmark
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: joeyluPosted on 2008-06-19 at 10:24:28ID: 21824358
Using <br /> is the most simpliest way to make each label underneath each other. However, if you need to line up your lable vertically, there are common way to accomplish:
> ox>
1: Using <div>.. As you mentioned in your post, Put each of your asp label and textbox into each DIV tag, something like
<div style="left: 100px; Top: 50; Position: absolute;">
<asp:Label ID="lblUsername" runat="server"></asp:Label
</div>
<div style="left: 100px; Top: 75; Position: absolute;">
<asp:Label ID="Label2" runat="server">New password: </asp:Label>
</div>
<div style="left: 175px; Top: 75; Position: absolute;">
<asp:TextBox ID="txtPassword" runat="server"></asp:TextB
</div>
<div style="left: 100px; Top: 100; Position: absolute;">
<asp:Label ID="Label3" runat="server">Comform password:</asp:Label>
</div>
This could line up all your controls to any where you want. Remeber, If you can always put a handle div tag and putting them into any Table cell or other DIV tag you like.
Something in CSS like:
div.divHandle {
position:relative;
}
then in your web form:
<div class="divHandle">
....above code...
</div>
2: The other solution is an old fashion way. Using Table. I attached the code at Code Snippet, Copy and paste it to your web form, you should get the picture
Select allOpen in new window