Center text in a label

Discussion in 'ASP .Net' started by kpg, Oct 7, 2005.

  1. kpg

    kpg Guest

    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
     
    kpg, Oct 7, 2005
    #1
    1. Advertising

  2. kpg

    kpg Guest

    > 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?
     
    kpg, Oct 7, 2005
    #2
    1. Advertising

  3. 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?
    >
    >
    >
     
    =?Utf-8?B?U3JlZWppdGggUmFt?=, Oct 7, 2005
    #3
  4. kpg

    Frankie Guest

    << 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" <> wrote in message
    news:%...
    >> 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?
    >
    >
     
    Frankie, Oct 7, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Bernsen

    Center Align Label and Hyperlink Control

    Tom Bernsen, Apr 22, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    17,858
    Ken Cox [Microsoft MVP]
    Apr 23, 2004
  2. Phillip Vong

    Center Label on Page

    Phillip Vong, Jan 12, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    525
    Phillip Vong
    Jan 13, 2007
  3. CSharpner
    Replies:
    0
    Views:
    1,061
    CSharpner
    Apr 9, 2007
  4. daniel kurtz

    Center text in web Label control

    daniel kurtz, Oct 11, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    124
  5. Knut Krueger
    Replies:
    8
    Views:
    282
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page