Skip to content

Instantly share code, notes, and snippets.

@Awilum
Created May 16, 2013 06:21
Show Gist options
  • Select an option

  • Save Awilum/5589742 to your computer and use it in GitHub Desktop.

Select an option

Save Awilum/5589742 to your computer and use it in GitHub Desktop.

Revisions

  1. Awilum created this gist May 16, 2013.
    102 changes: 102 additions & 0 deletions CSS Hacks!
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,102 @@
    /* IE8 Only */
    .myClass {
    color:red\0/;
    padding:70px\0/;
    }

    /* IE 6 Only */
    * html .myClass {
    ...
    }

    /* All except IE6 standards */
    .myClass {
    property /**/: value;
    }

    /* Firefox & IE 7, и выше */
    html>body .myClass {
    ...
    }

    /* Modern browsers only (not IE 7) */
    html>/**/body .myClass {
    ...
    }

    /* IE 7 Only */
    *:first-child+html .myClass {
    ...
    }

    /* Firefox Only */
    @-moz-document url-prefix() {
    .myClass {
    ...
    }
    }

    /* Opera Only */
    noindex:-o-prefocus, .MyClass {
    color:red;
    }

    /* IE7 Only */
    div[class^="myClass"] .myClass2 {
    ...
    }

    /* IE7 only */
    *+html .myClass {
    ...
    }

    /* hack for Opera <=9 */
    html:first-child .myClass {
    ...
    }

    /* Firefox, Opera, Konqueror, Safari */
    *|html .myClass {
    ...
    }

    /* IE8 beta 2 only (?)*/
    html:first-child .myClass [attr|=a-b] {
    ...
    }

    /* IE5/Mac only */
    /*\*//*/ .myClass { property: value; } /**/

    /* Gecko only */
    .myClass:not([attr*=""]) {
    ...
    }

    /* Opera < 9.5 only */
    @media all and (min-width: 0px) {
    html:first-child .myClass {
    ...
    }
    }

    /* Safari only */
    .myClass:not(:root:root) {
    ...
    }

    /* Safari 3.0 and Chrome only */
    @media screen and (-webkit-min-device-pixel-ratio:0) {
    .myClass {
    ....
    }
    }

    /* Chrome browser */
    body:nth-of-type(1) .myClass {
    ...
    }

    /* Safari browser css hack */
    body:first-of-type .myClass {property:value;}