Skip to content

Instantly share code, notes, and snippets.

@stan
Forked from ricardozea/ie67891011-css-hacks.txt
Created March 8, 2017 15:21

Revisions

  1. @ricardozea ricardozea revised this gist Mar 28, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -59,7 +59,7 @@ Place this script in the <head>:
    </script>
    <!--<![endif]-->

    Note: Seems the Conditional Comment is not necessary, but I like to include it for godo measure.
    Note: Seems the Conditional Comment is not necessary, but I like to include it for good measure.

    Usage:
    .ie10 .selector {...}
  2. @ricardozea ricardozea revised this gist Jun 30, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -51,11 +51,15 @@ http://www.impressivewebs.com/ie10-css-hacks/
    Conditional compilation: https://msdn.microsoft.com/en-us/library/8ka90k2e(v=vs.94).aspx

    Place this script in the <head>:
    <!--[if !IE]><!-->
    <script>
    if (/*@cc_on!@*/false && document.documentMode === 10) {
    document.documentElement.className+=' ie10';
    }
    </script>
    <!--<![endif]-->

    Note: Seems the Conditional Comment is not necessary, but I like to include it for godo measure.

    Usage:
    .ie10 .selector {...}
  3. @ricardozea ricardozea revised this gist Jun 29, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -60,6 +60,8 @@ Place this script in the <head>:
    Usage:
    .ie10 .selector {...}

    == More info here: https://philipnewcomer.net/2014/04/target-internet-explorer-10-11-css/

    IE10 and IE11
    ==================
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  4. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 7 additions and 4 deletions.
    11 changes: 7 additions & 4 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -37,15 +37,18 @@ IE10 Only
    Method 1: UA Sniffing, which isn't the most loved method to target browsers, but here it is anyway.
    http://css-tricks.com/ie-10-specific-styles/

    Use this JavaScript:
    var doc = document.documentElement;
    doc.setAttribute('data-useragent', navigator.userAgent);
    Place this script in the <head>:
    <script>
    var doc = document.documentElement;
    doc.setAttribute('data-useragent', navigator.userAgent);
    </script>

    Usage:
    html[data-useragent*='MSIE 10.0'] .selector {...}

    Method 2:
    Method 2: It used 'Conditional compilation' which is not UA sniffing. Also, it excludes IE11 as well.
    http://www.impressivewebs.com/ie10-css-hacks/
    Conditional compilation: https://msdn.microsoft.com/en-us/library/8ka90k2e(v=vs.94).aspx

    Place this script in the <head>:
    <script>
  5. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

    IE10 Only
    ==================
    Method 1:
    Method 1: UA Sniffing, which isn't the most loved method to target browsers, but here it is anyway.
    http://css-tricks.com/ie-10-specific-styles/

    Use this JavaScript:
  6. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ html[data-useragent*='MSIE 10.0'] .selector {...}
    Method 2:
    http://www.impressivewebs.com/ie10-css-hacks/

    Other option: place this script in the <head>:
    Place this script in the <head>:
    <script>
    if (/*@cc_on!@*/false && document.documentMode === 10) {
    document.documentElement.className+=' ie10';
  7. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -41,10 +41,8 @@ Use this JavaScript:
    var doc = document.documentElement;
    doc.setAttribute('data-useragent', navigator.userAgent);

    Then use this CSS:
    html[data-useragent*='MSIE 10.0'] h1 { color: blue; }

    --
    Usage:
    html[data-useragent*='MSIE 10.0'] .selector {...}

    Method 2:
    http://www.impressivewebs.com/ie10-css-hacks/
  8. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -34,6 +34,7 @@ http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

    IE10 Only
    ==================
    Method 1:
    http://css-tricks.com/ie-10-specific-styles/

    Use this JavaScript:
    @@ -45,7 +46,7 @@ html[data-useragent*='MSIE 10.0'] h1 { color: blue; }

    --

    Nice article with other IE10 CSS hacks:
    Method 2:
    http://www.impressivewebs.com/ie10-css-hacks/

    Other option: place this script in the <head>:
  9. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -33,8 +33,9 @@ IE9 Only
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

    IE10 Only
    http://css-tricks.com/ie-10-specific-styles/
    ==================
    http://css-tricks.com/ie-10-specific-styles/

    Use this JavaScript:
    var doc = document.documentElement;
    doc.setAttribute('data-useragent', navigator.userAgent);
  10. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,15 @@ html[data-useragent*='MSIE 10.0'] h1 { color: blue; }
    Nice article with other IE10 CSS hacks:
    http://www.impressivewebs.com/ie10-css-hacks/

    Other option
    Other option: place this script in the <head>:
    <script>
    if (/*@cc_on!@*/false && document.documentMode === 10) {
    document.documentElement.className+=' ie10';
    }
    </script>

    Usage:
    .ie10 .selector {...}

    IE10 and IE11
    ==================
  11. @ricardozea ricardozea revised this gist Jun 28, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -42,9 +42,13 @@ doc.setAttribute('data-useragent', navigator.userAgent);
    Then use this CSS:
    html[data-useragent*='MSIE 10.0'] h1 { color: blue; }

    --

    Nice article with other IE10 CSS hacks:
    http://www.impressivewebs.com/ie10-css-hacks/

    Other option

    IE10 and IE11
    ==================
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  12. @ricardozea ricardozea revised this gist Mar 25, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,6 @@ html[data-useragent*='MSIE 10.0'] h1 { color: blue; }
    Nice article with other IE10 CSS hacks:
    http://www.impressivewebs.com/ie10-css-hacks/


    IE10 and IE11
    ==================
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  13. @ricardozea ricardozea revised this gist Mar 25, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -42,6 +42,10 @@ doc.setAttribute('data-useragent', navigator.userAgent);
    Then use this CSS:
    html[data-useragent*='MSIE 10.0'] h1 { color: blue; }

    Nice article with other IE10 CSS hacks:
    http://www.impressivewebs.com/ie10-css-hacks/


    IE10 and IE11
    ==================
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  14. @ricardozea ricardozea revised this gist Mar 25, 2015. No changes.
  15. @ricardozea ricardozea revised this gist Mar 27, 2014. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,14 @@
    IE6 Only
    ==================
    *html or { _property:... }
    _selector {...}

    IE6 & IE7
    ==================
    *html or { _property: }

    IE7 Only
    ==================
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.
    *+html or { *property: } - Keep in mind that you have to put the IE7 property first within the same selector.

    IE8
    ==================
  16. @ricardozea ricardozea revised this gist Jan 3, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ IE7 Only
    IE8
    ==================
    .selector/*\**/ { color:#f00; }
    NOTE: LESS v1.5.0 shoots out an error when compiling the CSS if you use this hack :/
    **NOTE**: LESS v1.5.0 shoots out an error when compiling the CSS if you use this hack :/


    IE8 and IE9 (TOTALLY NOT NEEDED - I LEFT HERE FOR REFERENCE ONLY)
    @@ -25,6 +25,7 @@ Also, using "\9" is picked up by IE10 and IE11 so you need to redeclare the CSS
    IE9 Only
    ==================
    :root .class/#id { property:value \0/IE9; }
    **NOTE**: Prepos v4.0.1 shoots out an error when compiling the CSS if you use this hack :/
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

    IE10 Only
  17. @rzea rzea revised this gist Nov 19, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@ IE7 Only
    IE8
    ==================
    .selector/*\**/ { color:#f00; }
    NOTE: LESS v1.5.0 shoots out an error when compiling the CSS if you use this hack :/


    IE8 and IE9 (TOTALLY NOT NEEDED - I LEFT HERE FOR REFERENCE ONLY)
  18. @rzea rzea revised this gist Nov 19, 2013. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion ie67891011-css-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,12 @@ IE7 Only
    ==================
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.

    IE8 and IE9 (There doesn't seem to be an 'IE8 Only' hack)
    IE8
    ==================
    .selector/*\**/ { color:#f00; }


    IE8 and IE9 (TOTALLY NOT NEEDED - I LEFT HERE FOR REFERENCE ONLY)
    ==================
    .selector { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector

  19. @rzea rzea renamed this gist Nov 19, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  20. @rzea rzea revised this gist Nov 18, 2013. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions ie6789-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,14 @@ IE7 Only

    IE8 and IE9 (There doesn't seem to be an 'IE8 Only' hack)
    ==================
    Use \9 = p { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector
    The above solution doesn't work with font-family, so instead you need to use "\0/ !important" >> { font-family:Arial \0/ !important; }
    .selector { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector

    The above solution doesn't work with font-family, so instead you need to use "\0/ !important"
    Example: { font-family:Arial \0/ !important; }
    http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/

    Also, using "\9" is picked up by IE10 and IE11 so you need to redeclare the CSS rules with "-ms-high-contrast:". See info below.

    IE9 Only
    ==================
    :root .class/#id { property:value \0/IE9; }
  21. @rzea rzea revised this gist Nov 18, 2013. 1 changed file with 34 additions and 11 deletions.
    45 changes: 34 additions & 11 deletions ie6789-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,34 @@
    - To target only IE6, use:
    *html or { _property:... }
    - To target only IE7, use:
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.
    - To target IE8-9, use:
    \9 >> p { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector
    The above solution doesn't work with font-family, so instead you need to use "\0/ !important" >> { font-family:Arial \0/ !important; }
    http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
    - To target IE9+ only, use:
    :root .class/#id { property:value \0/IE9; }
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx
    IE6 Only
    ==================
    *html or { _property:... }

    IE7 Only
    ==================
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.

    IE8 and IE9 (There doesn't seem to be an 'IE8 Only' hack)
    ==================
    Use \9 = p { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector
    The above solution doesn't work with font-family, so instead you need to use "\0/ !important" >> { font-family:Arial \0/ !important; }
    http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/

    IE9 Only
    ==================
    :root .class/#id { property:value \0/IE9; }
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

    IE10 Only
    http://css-tricks.com/ie-10-specific-styles/
    ==================
    Use this JavaScript:
    var doc = document.documentElement;
    doc.setAttribute('data-useragent', navigator.userAgent);

    Then use this CSS:
    html[data-useragent*='MSIE 10.0'] h1 { color: blue; }

    IE10 and IE11
    ==================
    @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .selector { property:value; }
    }
  22. Ricardo Zea revised this gist Jun 13, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ie6789-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,10 @@
    *html or { _property:... }
    - To target only IE7, use:
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.
    - To target IE8-9, use:
    - To target IE8-9, use:
    \9 >> p { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector
    The above solution doesn't work with font-family, so instead you need to use "\0/ !important" >> { font-family:Arial \0/ !important; }
    http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
    - To target IE9+ only, use:
    - To target IE9+ only, use:
    :root .class/#id { property:value \0/IE9; }
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx
  23. Ricardo Zea created this gist May 9, 2013.
    11 changes: 11 additions & 0 deletions ie6789-hacks.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    - To target only IE6, use:
    *html or { _property:... }
    - To target only IE7, use:
    *+html or { *property:... } - Keep in mind that you have to put the IE7 property first within the same selector.
    - To target IE8-9, use:
    \9 >> p { color:#f00\9; } - http://stackoverflow.com/questions/660652/ie8-css-selector
    The above solution doesn't work with font-family, so instead you need to use "\0/ !important" >> { font-family:Arial \0/ !important; }
    http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
    - To target IE9+ only, use:
    :root .class/#id { property:value \0/IE9; }
    http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx