473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 4135
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.Attributes.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***@thereforeiam.com> wrote in message
news:%2****************@tk2msftngp13.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
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...
3
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...
3
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...
1
by: Aitham alama | last post by:
How can i make a dynamically created web label control to to be Center allignment Thanks
0
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...
4
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...
5
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...
11
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...
2
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.