CSS files vs skin files
Q:开发者_如何学JAVA I want to know :
- Can the .skin files replace the CSS files?
What are the advantages of .skin files?
Can .skin files offer more than CSS files?
and
When to use skin files in my web application?
Asp.net skins are one part of asp.net Themes. From the MSDN docs:
Themes are made up of a set of elements: skins, cascading style sheets (CSS), images, and other resources. At a minimum, a theme will contain skins. Themes are defined in special directories in your Web site or on your Web server.
Skins are used to define default markup for asp.net server controls:
<asp:button runat="server" BackColor="lightblue" ForeColor="black" />
whereas CSS is used to style your native HTML elements (of course asp.net server controls render as native elements so CSS can also be used to style these
CSS Files is a .css
file contains style tags nothing more (for example, page.css)
But, a theme
or skin
file might be a set of files containing images, icons, css files, js files which can be used or integrated as sort of a plugin to change the appearance of the Application. (for example, a joomla template)
Skins are slightly smarter than css files in that sense that css contains only markup, while skins can contain scripts as well for a more dynamic content. So skins are translated to both css and javascript to be able to be used in a browser.
I've not actually worked with skins, but they seem to be easy configured, so that could be an advantage, although it seems to me that you got more freedom when you develop your css yourself and maybe enrich certain aspects of your website using a library like JQuery. It seems to me that skins are such an overall solution that they leave little freedom for finetuning. But since I've not actually used them, I'm not sure about that.
One thing to consider is how skin files can apply their "themes". http://weblogs.asp.net/kannanambadi/archive/2009/06/22/improve-aspx-page-performance-by-reducing-http-response-size-by-combining-skin-amp-css.aspx
Skin files render inline styles, which can easily, quickly increase the size of the resultant HTML output.
In my opinion, there is a time and place for things and skin files are no different. Sometimes (many times) you will end up with cleaner, smaller output HTML if you use CSS for styling instead of a skin file.
精彩评论