Themes and Skins
Many users like to personalize their favorite web sites by setting the look and feel of the site’s controls to meet their own personal aesthetic preferences. ASP.NET 2.0 provides support for themes that enable you to offer that level of personalization to your users.
A theme is a collection of skins . A skin describes how a control should look. A skin can define stylesheet attributes, images, colors, and so forth.
Having multiple themes allows your users to choose how they want your site to look by switching from one set of skins to another at the touch of a button. Combined with personalization, your site can remember the look and feel your user prefers.
There are two types of themes. The first, called stylesheet themes
, define styles that may be overridden by the page or control. These are, essentially, equivalent to CSS style sheets. The second type, called customization themes
, cannot be overridden. You set a stylesheet theme by adding the StyleSheetTheme
attribute to the Page
directive, and, similarly, you set a Customization theme by setting the Theme attribute in the Page
directive.
Tip
You can set the default theme for the entire web site in web.config by adding the pages
element to the system.web
element within the configuration
element, as follows:
<configuration> <system.web> <pages theme="Psychedelic" /> </system.web> </configuration>
Settings in the page will override those in web.config.
In any given page, the properties for the controls are set in this ...
Get Programming ASP.NET, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.