Using Style Sheets
We have seen how skins can be used to apply specific styles on ASP.NET server controls. They are really useful for styling elements such as navigation, form, and other server-side-based controls. Without a doubt, they are pretty nifty and practical tools to have in our toolbox.
However, in the world of MCMS, an important aspect of ensuring that the site has a consistent look and feel throughout is to make sure that content entered by authors in placeholder controls, like the HtmlPlaceholderControl
, also follows the style guidelines of the website. In order to enforce design rules of HTML content, skins do not help us very much. For HTML controls and code, we still have to make use of good old cascading style sheets.
Previously, to apply a CSS file to a site, we would add a<link>
tag to all template files and web forms that required it:
<link type="text/css" href="UrlOfFile.css"/>
Or, we could embed styles directly within the page itself, using<style>
tags...