Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2004, 10:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default Justify Text in a Label

I am putting numerical text in labels. I want to have them justified/aligned to the right in the labels. I have tried using the style properties to no avail. Is there a setting I'm missing?

Thanks in advance.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
 
Old September 3rd, 2004, 03:40 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Did you try the text-align style property?

Brian
 
Old September 7th, 2004, 09:41 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I did give this a try, but to no avail. I was a bit surprised by this.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
 
Old September 7th, 2004, 10:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Are you formatting this on the client side or server side? I have had some problems using client side that worked on the server side.

J
 
Old September 7th, 2004, 11:00 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using the text-align property in the stylesheet class. I believe this manifests itelf on the client side.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
 
Old September 7th, 2004, 11:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Is the label in a table?

Poetic...
 
Old September 7th, 2004, 01:54 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No it is not - but that gives me an idea. I might just put that text in a table cell and align it right.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.
 
Old September 7th, 2004, 02:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Right! ;)

J
 
Old September 7th, 2004, 03:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The problem with a Label control is that it is usually as wide as it contents. A Label is rendered as a <span> tag, so all it contains is the actual text / contents of the label.

So, the text is actually right-aligned. However, since the label matches the size of the content, you won't notice the difference.

To effectively right-align, you need a container that is larger than the contents. A <td> is one way; a <span> tag with an explicit width wider than the contents is another, and for numbers, a right-aligned text box could be another useful possibility.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: The gallery by Muse (Track 9 from the album: Hullabaloo) What's This?
 
Old September 10th, 2004, 01:57 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 218
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did the trick. Thanks.

- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.





Similar Threads
Thread Thread Starter Forum Replies Last Post
text-align:justify; and <BR> anshul HTML Code Clinic 23 June 18th, 2018 03:04 AM
Center Text within Label testsubject Visual Studio 2005 5 October 15th, 2011 12:59 PM
How to create label with vertical text? Dragonist Classic ASP Basics 17 September 19th, 2008 02:30 PM
Dynamic Text in Label funnylearning .NET Framework 2.0 2 September 18th, 2006 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.