asp.net 2.0 themes and css

Discussion in 'ASP .Net' started by Mike P, Apr 4, 2006.

  1. Mike P

    Mike P Guest

    If I am using themes for example on a label control, how do I also apply
    css to the control? I have a number of label controls that I want to be
    treated differently to my standard label controls by using an image for
    their backgrounds.


    Thanks,

    Mike
     
    Mike P, Apr 4, 2006
    #1
    1. Advertisements

  2. You can define multiple <asp:Label> tags in a skin file with different
    SkinId s -- then you can specify the SkinID for any asp:Label on your
    webpage
     
    Swanand Mokashi, Apr 4, 2006
    #2
    1. Advertisements

  3. Set the CssClass property to whatever style you want to use.
     
    Erik Funkenbusch, Apr 4, 2006
    #3
  4. Mike P

    clintonG Guest

    WRONG
    Themes over-ride class declarations. The class declaration would have to be
    applied to the Skin.

    <%= Clinton Gallagher
     
    clintonG, Apr 4, 2006
    #4
  5. Perhaps I misunderstood, but I thought he was asking about applying a css
    theme to a label control. If he means he's using a skin, then you're
    correct.
     
    Erik Funkenbusch, Apr 4, 2006
    #5
  6. Mike P

    clintonG Guest

    Didn't mean to yell... %-)

    <%= Clinton Gallagher
     
    clintonG, Apr 5, 2006
    #6
  7. Mike P

    Mike P Guest

    Here is my skin that relates to the label :

    <asp:Label runat="server" Forecolor="#000000" Font-Names="Verdana"
    Font-Size="9pt"
    Backcolor="Silver" Font-Bold="True" SkinID="Main"
    CssClass="Heading" />

    Here is my css for the CssClass :

    ..heading {background-image: url(../images/titlegray.jpg);
    color: black;
    font-weight:bold;
    font-family:Verdana;}

    And here is the aspx page that I want to apply it to :

    <asp:Label ID="lblLogin" runat="server" SkinID="Main">
    Login</asp:Label>


    This doesn't apply the CssClass to the label. Can anybody tell me what
    is wrong with my code?
     
    Mike P, Apr 5, 2006
    #7
  8. Mike P

    gerry Guest

    css classnames are case sensitive and are prefixed in the stylesheet with a
    '.'

    so either
    CssClass="Heading"
    .Heading{ .. }

    or
    CssClass="heading"
    .heading{ .. }
     
    gerry, Apr 10, 2006
    #8
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.