diff options
-rw-r--r-- | IE-Media-Queries.html | 13 | ||||
-rw-r--r-- | README.md | 20 |
2 files changed, 33 insertions, 0 deletions
diff --git a/IE-Media-Queries.html b/IE-Media-Queries.html new file mode 100644 index 0000000..68b75a2 --- /dev/null +++ b/IE-Media-Queries.html @@ -0,0 +1,13 @@ +<!--[if lt IE 9]> +<script type="text/javascript"> +var headID = document.getElementsByTagName("head")[0]; +var cssNode = document.createElement('link'); +if (document.documentElement.clientWidth > "min screen size here" { +cssNode.type = 'text/css'; +cssNode.rel = 'stylesheet'; +cssNode.href = 'Your css file here'; +cssNode.media = 'screen'; +headID.appendChild(cssNode); +} +</script> +<![endif]-->
\ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0135405 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# IE-Media-Queries # +A simple script to use media queries in IE 8 and lower. +## Usage ## +Simply insert the following code into the <head> of your page. + + <!--[if lt IE 9]> + <script type="text/javascript"> + var headID = document.getElementsByTagName("head")[0]; + var cssNode = document.createElement('link'); + if (document.documentElement.clientWidth > "min screen size here" { + cssNode.type = 'text/css'; + cssNode.rel = 'stylesheet'; + cssNode.href = 'Your css file here'; + cssNode.media = 'screen'; + headID.appendChild(cssNode); + } + </script> + <![endif]--> + +You can change the > to a < to indicated a maximum screen size for a specific stylesheet.
\ No newline at end of file |