Use CSS in themes

W

Walter Wang [MSFT]

Hi Dave,

Following is some steps of my test to use the CSS from a theme:

1. Create a default web site, add the App_Themes folder, create a new theme
named "Theme1"
2. Create a new stylesheet in theme1 with following content:

..highlight
{
background-color: Yellow;
}

3. Create a new skin in Theme1 with following content:

<asp:Label CssClass="highlight" runat="server" />

4. In Default.aspx, use this theme:

<%@ Page Theme="theme1" ...

5. Create a new label in it:

<asp:label ID="label1" runat="server" Text="Hello World"></asp:label>

6. View this page in browser, you will notice the background color of the
label is Yellow as the stylesheet applied.

For more information, please refer to following article:

#Themes In ASP.NET 2.0
http://www.odetocode.com/Articles/423.aspx
Themes and CSS files can work together to control the look of your
application. You can add one or more .css files into a theme directory.
ASP.NET will automatically apply all of a theme's style sheets into a page
by injecting a <link> element for each .css into the header of a page. Your
page must have runat="server" in the <head> tag for the automatic style
sheet inclusion. The pages created by the IDE have this setting
automatically.


Let me know if this answers your question.

Sincerely,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top