How to set style of label?

  1. #1

    How to set style of label?

    In order to keep a strict separation of UI from data, I want to be able to specify the style of a control, such as a Label to make the text bold and a certain font. But, the actual text value will be set from codebehind. I don't want to do something like this: lblVersion.Text = "V1.215. I much prefer to just set the text value here, but in the markup somehow specify the font styling. Any help would be appreciated.
  2. #2

    RE: How to set style of label?

    Hi dbassett74,

    The following sample demonstrate three different ways to style a Label using css.

    Example

    <style type="text/css">
        #Label1 {
            padding: 10px;
        }
        
        .blue {
            border: 2px solid blue;
        }
    </style>
    
    <ext:Label ID="Label1" runat="server" Text="V1.215" StyleSpec="background-color: red;" Cls="blue" />
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: How to set style of label?

    Thanks! Two more questions:

    1) What is the nice looking dark blue color that is used in Coolite like in the Tab and Panel headers? I want to mimic that color in the label.

    2) Is there a good CSS reference site that I could use?

Similar Threads

  1. Replies: 3
    Last Post: Aug 04, 2010, 9:00 PM
  2. [CLOSED] Label Style / Obtain label color based on theme
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Apr 15, 2010, 10:35 AM
  3. Style and Css
    By Yannis in forum 1.x Help
    Replies: 4
    Last Post: Oct 28, 2009, 10:12 AM
  4. Label style
    By javito in forum 1.x Help
    Replies: 2
    Last Post: Oct 08, 2009, 9:46 AM
  5. checkbox style bug
    By Kaido in forum Bugs
    Replies: 0
    Last Post: Jun 19, 2009, 4:26 AM

Posting Permissions