Alternate Style Sheets – The css zen garden example
As mentioned on the ieblog, IE8 has a new feature for supporting alternating style sheets.
One of the best web sites for demonstrating css power is the well known csszengarden which includes a single html file with many (hundreds!) of css implementations suitable for that particular html.
In order to show the power of IE8’s new feature I have created an example page which contains alternating style sheet for some of css zen garden’s style’s.
All I did was adding this code so the html will now include the required tags for the alternating style sheets:
1: <script runat="server">
2: protected void Page_Load(object sender, EventArgs e)
3: {
4: for (int i = 100; i < 120; i++)
5: {
6: HtmlLink link = new HtmlLink();
7: link.Attributes.Add("type", "text/css");
8: link.Attributes.Add("rel", "alternate stylesheet");
9: link.Attributes.Add("title", i.ToString());
10: link.Attributes.Add("href", "http://www.csszengarden.com/" + i.ToString() + "/" + i.ToString() + ".css");
11: this.Header.Controls.Add(link);
12: }
13: }
14: </script
The result can be viewed here for users who use IE8.