Created
April 28, 2014 09:20
-
-
Save contensis/11366500 to your computer and use it in GitHub Desktop.
Working with CSS Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' If the same URL is registered twice it will only output one reference. | |
' The URL is used as a key to prevent duplicates. | |
' Add a CSS file to the document head | |
CurrentContext.Page.CSS.Add("styles.css") | |
' Note on IEConditions: you can specify any version of IE, the examples below are used for illstration purposes and are not exhaustive | |
' Add a CSS file with an IECondition (target IE7) | |
CurrentContext.Page.CSS.Add("styles.css", IECondition.IsVersion(7)) | |
' Add a CSS file with an IECondition (target IE9+) | |
CurrentContext.Page.CSS.Add("styles.css", IECondition.IsGreaterThanOrEqualTo(9)) | |
' Add a CSS file with an IECondition (target IE) | |
CurrentContext.Page.CSS.Add("styles.css", IECondition.IsIE) | |
' Add a CSS file with an IECondition (target IE6 & IE7) | |
CurrentContext.Page.CSS.Add("styles.css", IECondition.IsLessThan(8)) | |
' Add a CSS file with a media type | |
CurrentContext.Page.CSS.Add("styles.css", "print") | |
' Add a CSS file with an IE condition & media type | |
CurrentContext.Page.CSS.Add("styles.css", "print", IECondition.IsVersion(7)) | |
' Add inline CSS | |
CurrentContext.Page.CSS.Add("body{background:#000;}") | |
' Add inline CSS with an IECondition | |
CurrentContext.Page.CSS.Add("body{background:#000;}", IECondition.IsVersion(7)) | |
' Add inline CSS with a media type | |
CurrentContext.Page.CSS.Add("body{background:#000;}", "print") | |
' Add inline CSS with a media type and a IECondition | |
CurrentContext.Page.CSS.Add("body{background:#000;}", "print", IECondition.IsVersion(7)) | |
' Remove a CSS file from the document | |
CurrentContext.Page.CSS.Remove("styles.css") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment