Questions on ASP.NET themes?
1) If I create a theme and a skin file and a css file to go with that theme, does the skinfile automatically pickup the css file I created? What happens if you have multiple css files under a theme?
2) Do css files in themes override global css files? I开发者_运维技巧 created a global one and the theme that had a css file did not change the background color to the one I had in the theme, but the theme that did not have a css file, did change the background color to the one in the global css file.
3) It appears that skins and css files are the same? Can't I just create a theme and use css files within the themes instead of skins? Are skins just for asp.net server controls?
I dont like skinning and prefer to just use plain ol CSS. Thats precisely what a skin is but very limited. I say drop the skin and stick to CSS files.
You can have many theme folders within the App_Themes folder. An ASP.Net Theme can consist of many skin files and many css files.
- Yes, the Skin file is aware of the CSS file. When you apply a Theme, your page is made aware of all of the .css files in the Theme automatically.
- I'm not sure. Testing is the only way to go.
- No, .skin files are different than .css files. Yes, you can just use css files in a theme and skip the skins. Yes, skins are just for asp.net server controls.
Themes vs. Cascading Style Sheets
Themes are similar to cascading style sheets in that both themes and style sheets define a set of common attributes that can be applied to any page. However, themes differ from style sheets in the following ways:
- Themes can define many properties of a control or page, not just style properties. For example, using themes, you can specify the graphics for a TreeView control, the template layout of a GridView control, and so on.
- Themes can include graphics.
- Themes do not cascade the way style sheets do. By default, any property values defined in a theme referenced by a page's Theme property override the property values declaratively set on a control, unless you explicitly apply the theme using the StyleSheetTheme property. For more information, see the Theme Settings Precedence section above.
- Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style sheets can be applied.
Quoted from: ASP.NET Themes and Skins Overview
My Opinion:
Generally, if you've got a good understanding of CSS you don't really need .Skin files but Themes are still useful.
The Themes in asp.net are a bit confusing, they are somewhat css and a somewhat finicky.
Stick to normal css and create your own skin framework (eg: configured css folder) It will be much easier to use things like jQuery plugins with normal css and it will easier to work with designers who know normal css for cross browser development.
精彩评论