asp.net 2.0 themes and css

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

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

Set the CssClass property to whatever style you want to use.
 
WRONG
Themes over-ride class declarations. The class declaration would have to be
applied to the Skin.

<%= Clinton Gallagher
 
WRONG
Themes over-ride class declarations. The class declaration would have to be
applied to the Skin.

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.
 
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?
 
css classnames are case sensitive and are prefixed in the stylesheet with a
'.'

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

or
CssClass="heading"
.heading{ .. }
 

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

Back
Top