Center text in a label

K

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
 
K

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?
 
G

Guest

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..
 
F

Frankie

<< 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top