{"id":21823342,"url":"https://github.com/teabyii/hack-css","last_synced_at":"2026-05-05T13:31:27.080Z","repository":{"id":25020777,"uuid":"28440141","full_name":"teabyii/hack-css","owner":"teabyii","description":"A easy way to take css hack.","archived":false,"fork":false,"pushed_at":"2014-12-30T21:54:50.000Z","size":160,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T07:46:16.945Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teabyii.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-24T07:19:57.000Z","updated_at":"2019-08-12T04:13:29.000Z","dependencies_parsed_at":"2022-08-20T20:40:56.120Z","dependency_job_id":null,"html_url":"https://github.com/teabyii/hack-css","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teabyii%2Fhack-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teabyii%2Fhack-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teabyii%2Fhack-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teabyii%2Fhack-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teabyii","download_url":"https://codeload.github.com/teabyii/hack-css/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244790190,"owners_count":20510695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T17:30:53.225Z","updated_at":"2025-10-26T19:41:30.205Z","avatar_url":"https://github.com/teabyii.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hack CSS\n\nCollection for css hack in different browsers. Provide a easy way to take css hack.\n\n### less\n\nrequire less v1.7.0 or later\n\n```less\n@import \"path/to/hack-css.less\"\n\n// give hack for each selector which you need\n.class {\n    .only-ie6({\n        hasLayout: 1;\n    })\n\n    .only-ie7({\n        margin: 0;\n    })\n}\n\n// give hack for all selector together\n@only-ie6: {\n    .class {\n        hasLayout: 1;\n    }\n\n    #id {\n        padding: 0;\n    }\n}\n```\n\n### stylus\n\n```stylus\n// use block to give hack to all, but you should require after\n$only-ie6 = \n  .class \n    hasLayout 1\n  #id\n    padding 0\n\n@import 'path/to/hack-css'\n```\n\n```stylus\n// use block mixin to hack each selector\n@import 'path/to/hack-css'\n\n.class\n  +only-ie6()\n    hasLayout 1\n  +only-ie7()\n    padding 0\n```\n\n```stylus\n// if you want both\n@import 'path/to/hack-css'\n... // your code\n@import 'path/to/hack-css'\n```\n\n\u003e Note: Now don't support only-ie11, or-saf5-saf6, only-op, in the first way by stylus. If want to hack, please take the second way, sorry.\n\n### sass \u0026 scss\n\n```sass\n// hack each selector\n.class {\n    @include only-ie6 {\n        hasLayout: 1;\n    }\n}\n\n// hack all selector\n@include only-ie6 {\n    #id {\n        hasLayout: 1;\n    }\n}\n```\n\n```scss\n.class\n  +only-ie6\n    hasLayout: 1\n\n+only-ie6\n  .class \n    padding: 0\n```\n\n## Hack list\n\n- only-ie6\n- only-ie7\n- only-ie8\n- or-ie6-ie7\n- or-ie6-ie7-ie8\n- or-ie8-ie9-ie10\n- or-ie9-ie10\n- only-ie11\n- or-saf2-saf3\n- or-saf5-saf6  \n  safari 5.1 ~ safari 6\n- only-ff  \n  firefox 3.5+\n- only-op  \n  opera 9.5+\n\n## Reference\n\n- [all browsers hacks](http://browserhacks.com/)  \n- [css hacks](http://www.paulirish.com/2009/browser-specific-css-hacks/)  \n- [media blocks hacks](http://keithclark.co.uk/articles/moving-ie-specific-css-into-media-blocks/) \n- [conditionnal stylesheets vs css hacks](http://www.paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/)  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteabyii%2Fhack-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteabyii%2Fhack-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteabyii%2Fhack-css/lists"}