473,804 Members | 3,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Center text in a label

kpg
Here's an easy one.

I have an asp:label on a web page.

How do I center the text in the label?

???

TIA
kpg

Nov 19 '05 #1
3 4157
kpg
> How do I center the text in the label?

OK. I just answered my question.

Set the text to: "<center>my text</center>"

Why not just provide that as an option?
Nov 19 '05 #2

Just add an attribute , Label1.Attribut es.Add("style", "align=center") ; ..
Ideally in large projects you would be using a CssClass for each style, to
assure uniformity across the site..

"kpg" wrote:
How do I center the text in the label?


OK. I just answered my question.

Set the text to: "<center>my text</center>"

Why not just provide that as an option?

Nov 19 '05 #3
<< Why not just provide that as an option? >>

My Guess:
<center> is a depracated HTML tag - meaning it's there, but not supposed to
be used any longer because we have better ways to do it. Styling is
"supposed" to be done with css like Sreejith shows, and not HTML tags. Same
would be then for <bold>, <strong> etc... (i.e., don't use them and use CSS
instead).

-HTH

-F

"kpg" <ip***@therefor eiam.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
How do I center the text in the label?


OK. I just answered my question.

Set the text to: "<center>my text</center>"

Why not just provide that as an option?

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
19324
by: Petesman | last post by:
I am trying to make a prompt that will ask the user for some input... If I just use var input = prompt("dafa") everything works fine but the box is put in the top left corner of the window. I need it to be centered so... I was doing some research on the net (never really used much JavaScript before) and was reading the only way to do this is by making your own custom prompt. In my attempts of doing so I came up with this code below. The...
3
4545
by: Mark Urish | last post by:
I want to center-align the text in 2 Label controls, and I want the 1st char of their text to line up ------------------------------------------------------------------------------ label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter label1.Text = "IDLE"; //4 char strin label2.Text = "RUN ";//4 char string, //but trailing space ignored and it is centered as thoug...
3
8687
by: Tom Bernsen | last post by:
This should be simple, I did it with a datagrid easily enough. Using VS Net 1.1, I want a label over the datagrid and a hyperlink below it (from WebForms toolbox), with BOTH of them centered (text and control) over the page. In other words, everything centered, automatic with window size. If you have a solution not using VS (or HTML substitutes but would prefer using VS controls, clearly need datagrid and aspx), I'm all ears also. ...
1
1427
by: Aitham alama | last post by:
How can i make a dynamically created web label control to to be Center allignment Thanks
0
2676
by: Dessip | last post by:
Hey, The code that follows im having problems with, i think tis the CSS, but i dont have a clue of fixing it, i have tried any things but without the float:Left there is no point the folloing code lays the page out like so: | obj1 obj2 obj4 obj6 obj8 | | obj3 obj5 obj7 obj9
4
25640
by: Phillip Vong | last post by:
Using VS2005 / VB.NET / ASP.NET Newbie trying to learn. I have a simple label and I want to center this on the page, but I can not. When I hightlight this in VS2005 and say to center it, it does nothing. How do I hard code this to center on a pager? <asp:Label ID="HeadingL" runat="server" Font-Size="XX-Large" Text="Summary" ForeColor="DarkBlue"></asp:Label><br />
5
2434
by: Nathan Sokalski | last post by:
As most of us probably know, the <centertag is deprecated. Because many elements and controls have an align attribute, centering them is easy enough. However, certain elements/controls do not (such as the ASP.NET Button and Label controls). For the ASP.NET label control I usually just add the following attributes: Width="100%" style="text-align:center;" However, this does not work for controls such as the ASP.NET Button control. The...
11
4023
by: Mel | last post by:
Does anyone know a way to center the info. on a webpage? I want my web site to work like MySpace.com where the page content remains centered when I resize the browser window. For the life of me I can't figure out how to do it. I am desperate to figure it out today! Please help! FYI: I am referencing one master page file in all of my web pages. The content of my pages are stored in one or more panel controls. - Melissa
2
50356
by: theinvisibleGhost | last post by:
Is there any easy way of centering a label in a form or panel? I can dock, and anchor but not get my label to stay centered, short of resorting to playing with the top and left properties of the label each time the form is resized or the label changed. Cheers Chris.
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.