Mittwoch, 7. März 2007

CSS versus Theme: Wann und wie?

Here are some points to consider when deciding on a skin file versus a style sheet entry.

  1. Web designers will be more comfortable with css files. If you put the design of your site into the hands of professionals than you should be asking them to use css wherever possible. This will allow you to just drop new and updated css files into the theme folders and be ready to go.
  2. Developers might be more comfortable with skins. Since skins look just like a control declaration, a developer will have an easy time creating a skin file. There is also no need to know in advance what HTML a complex server-side web control will produce in order to write the correct class and styles.
  3. Skins are applied server-side and can set more than just style related properties. For example, in our Calendar.skin example we were able to set a default for the DayNameFormat for all calendar controls using the theme.
    Likewise, you can control some areas with CSS (like the body element above) with style sheets and not skins
  4. While the settings in a style sheet cascade, the properties in a skin are absolute, i.e. you can override a style sheet with a local setting but not a skin (unless you take one of the steps outlined in this article).
  5. Different browsers may react to style sheets in different ways. You can count on skin files to always apply their properties to controls consistently on the server (it’s up to ASP.NET to translate those settings into the correct settings for the client).

(cited from http://www.odetocode.com/articles/423.aspx. Themes In ASP.NET 2.0 Posted by scott on Sonntag, 7. August 2005 )