{"id":640,"date":"2010-11-08T14:54:08","date_gmt":"2010-11-08T06:54:08","guid":{"rendered":""},"modified":"2014-03-11T22:34:04","modified_gmt":"2014-03-11T14:34:04","slug":"css-hack%e8%af%a6%e7%bb%86","status":"publish","type":"post","link":"http:\/\/www.xiaoyebailong.com\/index.php\/2010\/11\/08\/640.htm","title":{"rendered":"CSS hack(\u8be6\u7ec6)"},"content":{"rendered":"<p><span class=\"Apple-style-span\" style=\"word-spacing: 0px; font: medium Simsun; text-transform: none; color: rgb(0,0,0); text-indent: 0px; white-space: normal; letter-spacing: normal; border-collapse: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px\"><span class=\"Apple-style-span\" style=\"font-size: 14px; line-height: 23px; font-family: simsun; text-align: left\"><\/p>\n<p>\u5b66\u4e60CSS\uff0c\u9664\u4e86\u57fa\u7840\uff0c\u8fd8\u6709\u5fc5\u5b66\u7684\u4e00\u8bfe\uff0c\u5c31\u662fCSS hack\uff0c\u5f88\u591a\u4e66\u7c4d\u4e0a\u90fd\u6709\u6d89\u53ca\u3002\u5f53\u65f6\u89c9\u5f97\u8fd9\u4e2a\u4e1c\u897f\u5f88\u795e\u79d8\uff0c\u53ef\u4ee5\u9488\u5bf9\u67d0\u4e2a\u6216\u67d0\u4e9b\u6d4f\u89c8\u5668\u5199\u4e9b\u7279\u522b\u7684 CSS \u6837\u5f0f\u800c\u4e0d\u5f71\u54cd\u5176\u4ed6\uff0c\u800c\u4e14\u7528\u8d77\u6765\u4e5f\u5f88\u65b9\u4fbf\u3002<br \/>\n\u867d\u7136\u5982\u6b64\uff0c\u4f46\u662f\uff0c\u5f88\u5c11\u6709\u4eba\u77e5\u9053\uff0c\u5b83\u5230\u5e95\u662f\u4ec0\u4e48\u4e1c\u897f\uff0c\u4f7f\u7528CSS hack\u597d\u4e0d\u597d\uff0c\u4ee5\u53ca\u5b83\u662f\u600e\u6837\u5b9e\u73b0\u7684\uff1f<br \/>\n\u4e0b\u9762\uff0c\u5c31\u8c08\u4e00\u4e0b\u6211\u5bf9CSS hack\u7684\u8ba4\u8bc6\u3002\u5e0c\u671b\u80fd\u5e2e\u52a9\u5927\u5bb6\u6b63\u786e\u7684\u8ba4\u8bc6CSS hack\u3002<br \/>\n\u4ecb\u7ecd\u4e4b\u524d\uff0c\u8bf7\u5148\u8bb0\u4f4f\u4e00\u53e5\u8bdd\uff1a<strong>\u4f60\u4eca\u5929\u7528CSS hack\u89e3\u51b3\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u660e\u5929\u6d4f\u89c8\u5668\u5c31\u53ef\u80fd\u8ba9\u4f60\u90a3\u89e3\u51b3\u95ee\u9898\u7684CSS hack\u53d8\u6210\u53e6\u4e00\u4e2a\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/strong><\/p>\n<p>\n<span style=\"font-size: 24px; line-height: 36px\"><strong>CSS hack\u7b80\u4ecb<\/strong><\/span><\/p>\n<p>\u8fd9\uff0c\u8fd8\u8981\u4eceW3C CSS2.1\u7684\u6807\u51c6\u8bf4\u8d77\u3002<br \/>\nW3C CSS2.1\u7684\u6807\u51c6\u7684\u7b2c\u56db\u7ae0\uff0c\u8bb2\u4e86CSS\u7684\u57fa\u672c\u8bed\u6cd5\uff0c\u6570\u636e\uff0c\u4ee5\u53ca\u503c\uff0c\u8fd8\u8bb2\u5230\u4e86\u5982\u4f55\u53bb\u5904\u7406\u4e0d\u5408\u7406\u7684\u503c\u53ca\u58f0\u660e\u7b49\u3002\u53ef\u4ee5\u53c2\u8003\u6211\u5206\u4eab\u7684\u53e6\u5916\u4e24\u4e2a\u5e16\u5b50\uff1a<a rel=\"nofollow\" title=\"\u3010\u5206\u4eab\u3011\u8bf4\u8bf4\u6807\u51c6 --CSS\u6807\u51c6\u4e2d\u7684\u503c\" href=\"http:\/\/topic.csdn.net\/u\/20100714\/20\/759e2fc2-a619-42b8-%20a8e9-6fcab711f7cb.html?99181\" target=\"_blank\" style=\"color: rgb(0,45,147); text-decoration: none\">\u3010\u5206\u4eab\u3011\u8bf4\u8bf4\u6807\u51c6 &#8211;CSS\u6807\u51c6\u4e2d\u7684\u503c<\/a>\uff0c<a rel=\"nofollow\" title=\"\u3010\u5206\u4eab\u3011\u8bf4\u8bf4\u6807\u51c6--\u6211 \u7684\u773c\u91cc\u53ea\u6709\u4f60--CSS\u7684\u9519\u8bef\u89e3\u6790\u89c4\u5219\" href=\"http:\/\/topic.csdn.net\/u\/20100714\/10\/a2ef50b1-306c-4539-9f51-e71978cb4700.html?80187\" target=\"_blank\" style=\"color: rgb(0,45,147); text-decoration: none\">\u3010\u5206\u4eab\u3011\u8bf4\u8bf4\u6807\u51c6&#8211;\u6211 \u7684\u773c\u91cc\u53ea\u6709\u4f60&#8211;CSS\u7684\u9519\u8bef\u89e3\u6790\u89c4\u5219<\/a>\u3002<br \/>\nW3C CSS2.1 \u6807\u51c6\u4e5f\u89c4\u5b9a\u4e86\u6d4f\u89c8\u5668\u5e94\u5f53\u652f\u6301\u7684\u7279\u6027\u5c5e\u6027\u6216\u503c\u3002<br \/>\n\u867d\u7136\u5982\u6b64\uff0cW3C\u4e5f\u4e0d\u53ef\u80fd\u5f3a\u5236\u6d4f\u89c8\u5668\u5382\u5546\u5fc5\u987b\u9075\u5faa\u6807\u51c6\u3002\u56e0\u6b64\u5c31\u51fa\u73b0\u4e86\u5404\u5927\u5382\u5546\u5bf9\u6807\u51c6\u7684\u5b9e\u73b0\u4e0d\u5c3d\u76f8\u540c\u7684\u73b0\u8c61\u3002\u7531\u4e8e\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\uff0c\u6bd4\u5982IE6\u3001 IE7\u3001 IE8\u3001 Firefox\u7b49\uff0c\u5bf9CSS\u89e3\u6790\u7684\u6807\u51c6\u4e0d\u540c\uff0c\u56e0\u6b64\u5bf9\u4e8e\u76f8\u540c\u7684 CSS\u4ee3\u7801\uff0c\u53ef\u80fd\u4f1a\u751f\u6210\u4e0d\u540c\u7684\u9875\u9762\u6548\u679c\uff0c\u4ece\u800c\u65e0\u6cd5\u5728\u6240\u6709\u6d4f\u89c8\u5668\u4e2d\u5f97\u5230\u6211\u4eec\u60f3\u8981\u7684\u6548\u679c\u3002\u8fd9\u65f6\uff0c\u6211\u4eec\u5c31\u9700\u8981\u9488\u5bf9\u4e0d\u540c\u7684\u6d4f\u89c8\u5668\u53bb\u5199\u4e0d\u540c\u7684CSS\u4ee3\u7801\uff0c\u8ba9\u5b83\u80fd\u591f\u5728\u6240\u6709\u6d4f\u89c8\u5668\u4e2d\u83b7\u5f97\u76f8\u540c\u7684\u6548\u679c\u3002\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u5c31\u662fCSS hack\u3002\u4e5f\u5c31\u662f\u5199\u51fa\u53ea\u6709\u4e2a\u522b\u6d4f\u89c8\u5668\u6216\u67d0\u4e9b\u6d4f\u89c8\u5668\u8bc6\u522b\u7684CSS\u4ee3\u7801\u3002<br \/>\nCSS hack\u662f\u56e0\u4e3a\u73b0\u6709\u6d4f\u89c8\u5668\u5bf9\u6807\u51c6\u7684\u89e3\u6790\u4e0d\u540c\uff0c\u4e3a\u4e86\u517c\u5bb9\u5404\u6d4f\u89c8\u5668\uff0c\u6240\u91c7\u7528\u7684\u4e00\u79cd\u8865\u6551\u65b9\u6cd5\u3002<br \/>\nCSS hack\u662f\u4e00\u79cd\u7c7b\u4f3c\u4f5c\u5f0a\u7684\u624b\u6bb5\uff0c\u4ee5\u6b3a\u9a97\u6d4f\u89c8\u5668\u7684\u65b9\u5f0f\u8fbe\u5230\u517c\u5bb9\u7684\u76ee\u7684\uff0c\u662f\u7528\u6d4f\u89c8\u5668\u7684\u517c\u5bb9\u6027\u5dee\u5f02\u6765\u89e3\u51b3\u6d4f\u89c8\u5668\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002<br \/>\n\u56e0\u6b64\uff0c\u5728\u8bbe\u8ba1\u4e4b\u521d\uff0c\u5199CSS hack\u9700\u8981\u9075\u5faa\u4ee5\u4e0b\u4e09\u6761\u539f\u5219\uff1a<br \/>\n&nbsp; \u20df<strong>\u6709\u6548<\/strong>\uff1a \u80fd\u591f\u901a\u8fc7 Web \u6807\u51c6\u7684\u9a8c\u8bc1<br \/>\n&nbsp; \u20df<strong>\u53ea\u9488\u5bf9\u592a\u53e4\u8001\u7684\/\u4e0d\u518d\u5f00\u53d1\u7684\/\u5df2\u88ab\u629b\u5f03\u7684\u6d4f\u89c8\u5668<\/strong>\uff0c \u800c\u4e0d\u662f\u76ee\u524d\u7684\u4e3b\u6d41\u6d4f\u89c8\u5668<br \/>\n&nbsp; \u20df<strong>\u4ee3\u7801\u8981\u4e11\u964b<\/strong>\u3002\u8ba9\u4eba\u8bb0\u4f4f\u8fd9\u662f\u4e00\u4e2a\u4e0d\u5f97\u5df2\u800c\u4e3a\u4e4b\u7684 Hack, \u65f6\u523b\u8bb0\u4f4f\u8981\u60f3\u529e\u6cd5\u53bb\u6389\u5b83\u3002<br \/>\n\u73b0\u5728\u5f88\u591ahacks\u5df2\u7ecf\u629b\u5f03\u4e86\u6700\u521d\u7684\u539f\u5219\uff0c\u800c\u6ee5\u7528hack\u4f1a\u5bfc\u81f4\u6d4f\u89c8\u5668\u66f4\u65b0\u4e4b\u540e\u4ea7\u751f\u66f4\u591a\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002<br \/>\n\u56e0\u6b64\uff0c<strong>\u5e76\u4e0d\u63a8\u8350\u4f7f\u7528CSS hack\u6765\u89e3\u51b3\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\u3002<\/p>\n<p>\n<span style=\"font-size: 24px; line-height: 36px\"><strong>CSS hack\u7684\u5b9e\u73b0\u65b9\u5f0f<\/strong><\/span><\/p>\n<p>\u6211\u603b\u7ed3\u4e86\u4e00\u4e0b\uff0c\u5b9e\u73b0CSS hack\u5927\u6982\u6709\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\uff1a<br \/>\n<span style=\"font-size: 16px; line-height: 24px\"><strong>1. \u5229\u7528\u6d4f\u89c8\u5668\u5bf9\u76f8\u540c\u4ee3\u7801\u7684\u89e3\u6790\u548c\u652f\u6301\u7684\u4e0d\u540c\u5b9e\u73b0\u7684hack<\/strong><\/span><br \/>\n\u4e0d\u540c\u6d4f\u89c8\u5668\u5bf9\u76f8\u540c\u7684CSS\u4ee3\u7801\u7684\u652f\u6301\u60c5\u51b5\u53ef\u80fd\u4e0d\u540c\u3002\u5c24\u5176\u662f\u5bf9\u9519\u8bef\u7684\u5199\u6cd5\u3002<br \/>\n\u4f8b\u5982\uff0c<br \/>\n&nbsp;<\/p>\n<dl class=\"code\" style=\"padding-right: 0px; overflow-y: auto; padding-left: 0px; font-size: 12px; overflow-x: auto; padding-bottom: 0px; margin: 0px; width: 718px; padding-top: 0px\">\n<dt style=\"font-weight: bold; color: rgb(51,51,51); text-indent: 6px; line-height: 24px; height: 24px; background-color: rgb(245,245,245)\">CSS code<\/dt>\n<dd style=\"border-right: rgb(221,221,221) 1px solid; border-top: rgb(221,221,221) 1px solid; margin: 0px; border-left: rgb(221,221,221) 1px solid; border-bottom: rgb(221,221,221) 1px solid\">\n<pre><div><span style=\"color: rgb(128,0,0); line-height: 18px\">#test<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">{<\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">\r\n       _width<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">:<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">80px<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">;<\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">\r\n    <\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">}<\/span><\/div>\r\n<\/pre>\n<\/dd>\n<\/dl>\n<p>\u5728IE7\u53ca\u4ee5\u4e0a\u7248\u672c\u7684\u6d4f\u89c8\u5668\u4e2d\u4f1a\u88ab\u5f53\u4f5c\u9519\u8bef\u7279\u6027\u800c\u820d\u5f03\uff0c\u4f46\u662f\u5728IE6\u4e2d\u53ef\u4ee5\u88ab\u6b63\u5e38\u7684\u89e3\u6790\u3002\u8fd9\u65f6\u5019\uff0c\u53ef\u4ee5\u628a_width\u5f53\u4f5chack\uff0c\u4e13\u95e8\u9488\u5bf9 IE6\u6765\u8bbe\u7f6e\u5143\u7d20\u7684\u5bbd\u5ea6\u3002<br \/>\n<span style=\"font-size: 16px; line-height: 24px\"><strong>2. \u4ee5Firefox\u6216Webkit\u7279\u6709\u7684\u6269\u5c55\u6837\u5f0f\u5b9e\u73b0\u7684hack<\/strong><\/span><br \/>\n\u4ee5-moz\u6216-webkit\u5f00\u5934\u7684\u6269\u5c55\u6837\u5f0f\uff0c\u662f\u6d4f\u89c8\u5668\u5bf9CSS\u6807\u51c6\u7684\u6269\u5c55\u3002\u8fd9\u4e9b\u7279\u6027\u53ea\u5728\u76f8\u5e94\u7684\u6d4f\u89c8\u5668\u91cc\u624d\u53ef\u4ee5\u88ab\u6b63\u5e38\u7684\u89e3\u6790\u3002 \u56e0\u6b64\u53ef\u4ee5\u88ab\u5f53\u4f5cCSS hack\u6765\u4f7f\u7528\u3002<br \/>\n<strong>\u4ee5-moz\u5f00\u5934\u7684Firefox\u7279\u6709\u6269\u5c55\u6837\u5f0f<\/strong><br \/>\nMozilla\u6d4f\u89c8\u5668\u652f\u6301\u7684\u4e00\u4e9b\u6269\u5c55\u662f\u4ee5-moz\u5f00\u5934\u7684\u3002\u8fd9\u4e9b\u6269\u5c55\u5305\u62ec\u4e86\u4e00\u4e9b\u529f\u80fd\uff0c\u4f8b\u5982\u5706\u5f62\u8fb9\u754c\u7b49\u3002\u8fd9\u79cdCSS\u53ea\u9002\u7528\u4e8eMozilla\u6d4f\u89c8\u5668\u3002<br \/>\n\u6bd4\u5982\uff0c-moz-opacity\u662f\u5728Firefox2.0\u7248\u672c\u51fa\u73b0\u7684\u7279\u6027\uff0c\u7528\u6765\u5b9e\u73b0\u5143\u7d20\u7684\u900f\u660e\uff0c\u4f46Firefox3.0\u4ee5\u540e\u7684\u7248\u672c\u4e2d\u4e0d\u518d\u652f\u6301\uff0c\u800c\u662f\u76f4\u63a5\u652f\u6301\u6807\u51c6\u4e2d\u7684opacity\u7279\u6027\u3002\u800c\u5176\u4ed6\u6d4f\u89c8\u5668\u4e0d\u652f\u6301-moz-opacity\u3002\u6240\u4ee5\uff0c\u53ef\u4ee5\u4f7f\u7528-moz-opacity\u6765\u9488\u5bf9Firefox2.0\u8bbe\u7f6e\u5143\u7d20\u7684\u900f\u660e\u5ea6\u3002<br \/>\n\u5173\u4e8eFirefox\u6269\u5c55\u6837\u5f0f\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u89c1<a rel=\"nofollow\" title=\"Mozilla CSS Extensions\" href=\"https:\/\/developer.mozilla.org\/en\/CSS_Reference\/Mozilla_Extensions\" target=\"_blank\" style=\"color: rgb(0,45,147); text-decoration: none\">Mozilla CSS Extensions<\/a>\u3002<br \/>\n<strong>\u4ee5-webkit\u5f00\u5934\u7684Webkit\u6d4f\u89c8\u5668\u7279\u6709\u6269\u5c55\u6837\u5f0f<\/strong><br \/>\n\u4e0e\u4ee5-moz\u5f00\u5934\u7684Firefox\u7279\u6709\u6269\u5c55\u6837\u5f0f\u76f8\u540c\uff0c\u4ee5-webkit\u5f00\u5934\u7684\u6837\u5f0f\u662f Webkit\u6d4f\u89c8\u5668\u7279\u6709\u7684\uff0c\u53ea\u6709Webkit\u6d4f\u89c8\u5668\u53ef\u4ee5\u89e3\u6790\u3002<br \/>\n\u6bd4\u5982\uff0c\u5728Webkit\u6d4f\u89c8\u5668\u4e2d\u53ef\u4ee5\u7528 -webkit-border-radius\u5b9e\u73b0\u5706\u89d2\u3002<br \/>\n<span style=\"font-size: 16px; line-height: 24px\"><strong>3. \u5229\u7528IE\u5bf9\u6807\u51c6\u7684\u652f\u6301\u7f3a\u9677\u5199\u7684CSS hack<\/strong><\/span><br \/>\n\u8fd9\u4e2a\u7c7b\u522b\u4ee5\u4e2d\u7684hack\u4ee5IE\u5bf9\u6807\u51c6\u7684\u652f\u6301\u7f3a\u9677\u4e3a\u57fa\u7840\uff0c\u53ef\u4ee5\u8ba9CSS\u4ee3\u7801\u9488\u5bf9IE6\u6216IE7\u4ee5\u5916\u7684\u6d4f\u89c8\u5668\u751f\u6548\u3002<br \/>\n\u4f8b\u5982\uff0c!important\u53ea\u6709IE7\u53ca\u4ee5\u4e0a\u7248\u672c\u7684IE\u53ca\u5176\u4ed6\u6d4f\u89c8\u5668\u652f\u6301\uff0c\u6240\u4ee5\uff0c\u53ef\u4ee5\u7528!important\u6765\u9488\u5bf9IE6\u4ee5\u5916\u7684\u6d4f\u89c8\u5668\u5199 CSS\u4ee3\u7801\uff1b\u518d\u5982\uff0chead:first-child+body selector\uff0c:first-child\u4e0d\u88abIE6\u652f\u6301\uff0c\u6240\u4ee5\u53ef\u4ee5\u7528\u6765\u9488\u5bf9IE6\u4ee5\u5916\u7684\u6d4f\u89c8\u5668\u7f16\u5199CSS\u4ee3\u7801\u3002<br \/>\n\u6b64\u5904\u4e0d\u5728\u4e00\u4e00\u5217\u4e3e\u3002<br \/>\n\u5f53\u7136\uff0c\u6709\u7684\u89c2\u70b9\u8ba4\u4e3a\u5e94\u7528CSS2.1\u6807\u51c6\uff0c\u4e0d\u5c5e\u4e8eCSS hack\u3002\u89c1<a rel=\"nofollow\" title=\"Tanteks Thoughts\" href=\"http:\/\/tantek.com\/log\/2005\/11.html\" target=\"_blank\" style=\"color: rgb(0,45,147); text-decoration: none\">Tantek&#8217;s Thoughts<\/a>\uff0cUsing A CSS2 Feature Is NOT a Hack\u3002<br \/>\n<span style=\"font-size: 16px; line-height: 24px\"><strong>4. \u4ee5IE\u7279\u6709\u7684\u6761\u4ef6\u6ce8\u91ca\u4e3a\u57fa\u7840\u7684hack<\/strong><\/span><br \/>\nIE\u6d4f\u89c8\u5668\u4e2d\u7279\u6709\u7684\u6761\u4ef6\u6ce8\u91ca\u4e5f\u7ecf\u5e38\u88ab\u7528\u4f5c hack\uff0c\u53ef\u4ee5\u9488\u5bf9\u7279\u5b9a\u7248\u672c\u7684IE\u5199CSS\u4ee3\u7801\u3002<br \/>\n\u4f8b\u5982\uff0c\u6d4b\u8bd5\u7528\u4f8b\uff1a<br \/>\n&nbsp;<\/p>\n<dl class=\"code\" style=\"padding-right: 0px; overflow-y: auto; padding-left: 0px; font-size: 12px; overflow-x: auto; padding-bottom: 0px; margin: 0px; width: 718px; padding-top: 0px\">\n<dt style=\"font-weight: bold; color: rgb(51,51,51); text-indent: 6px; line-height: 24px; height: 24px; background-color: rgb(245,245,245)\">HTML code<\/dt>\n<dd style=\"border-right: rgb(221,221,221) 1px solid; border-top: rgb(221,221,221) 1px solid; margin: 0px; border-left: rgb(221,221,221) 1px solid; border-bottom: rgb(221,221,221) 1px solid\">\n<pre><div><span style=\"color: rgb(0,128,0); line-height: 18px\">&lt;!--<\/span><span style=\"color: rgb(0,128,0); line-height: 18px\">[if IE 8]&gt;\r\n&lt;style type=&quot;text\/css&quot;&gt;\r\n  #test {\r\n       color: red;\r\n   }\r\n&lt;\/style&gt;\r\n&lt;![endif]<\/span><span style=\"color: rgb(0,128,0); line-height: 18px\">--&gt;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">h1 <\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">id<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">=&quot;test&quot;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">TEXT<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;\/<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">h1<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><\/div>\r\n<\/pre>\n<\/dd>\n<\/dl>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u4e2d\u7684 &quot;TEXT&quot;\uff0c\u53ea\u5728IE8\u4e2d\u624d\u4f1a\u662f\u7ea2\u8272\u3002<\/p>\n<p>\n<span style=\"font-size: 24px; line-height: 36px\"><strong>CSS hack\u6c47\u603b\u8868<\/strong><\/span><\/p>\n<p>\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\uff0c\u6211\u641c\u4e86\u597d\u591a\u5173\u4e8eCSS hack\u7684\u5185\u5bb9\uff0c\u5176\u4e2d\u8fd8\u6709\u4e00\u4e2a\u6bd4\u8f83\u8457\u540d\u7684CSS hack\u6c47\u603b\u8868\uff0c\u770b\u8d77\u6765\u4e0d\u9519\uff0c\u4f46\u7528\u8d77\u6765\uff0c\u53d1\u73b0\uff0c\u6709\u4e9b\u5df2\u7ecf\u4e0d\u9002\u7528\u4e86\u3002\u56e0\u4e3a\uff0c\u6d4f\u89c8\u5668\u7248\u672c\u66f4\u65b0\u7684\u592a\u5feb\u4e86\u3002<br \/>\n\u5927\u591a\u6570\u4eba\u5e94\u8be5\u90fd\u5f88\u719f\u6089\u8fd9\u5f20\u8868\u5427\uff1a<br \/>\n<img decoding=\"async\" alt=\"\" src=\"https:\/\/lh5.googleusercontent.com\/BYt2KLMdRzoZ9uzPFO_Pwtq5Gyhui1HtN_jn1_TLv77K2kYSGRcmYITInRoi09mXo8N1FHf_rcbqp0R_upiNYJQSrYYqZp5G2dgkvxWCnvVCtfnq\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" \/><br \/>\n\u8fd9\u8868\u770b\u8d77\u6765\u5f88\u58ee\u89c2\uff0c\u4f46\u662f\uff0c\u91cc\u9762\u7684\u6570\u636e\u90fd\u5df2\u7ecf\u5f88\u9648\u65e7\u4e86\u3002\u4e5f\u8bb8\u4f60\u7684hack\u4eca\u5929\u8fd8\u6709\u6548\uff0c\u660e\u5929\u6d4f\u89c8\u5668\u7248\u672c\u66f4\u65b0\u540e\uff0c\u4fbf\u5931\u53bb\u4e86\u6548\u679c\u3002\u6240\u4ee5\uff0c\u614e\u7528hack\u3002<\/p>\n<p>\u6211\u7ed3\u5408\u4e0a\u8868\uff0c\u53c8\u6536\u96c6\u4e86\u4e00\u4e0b\u7f51\u4e0a\u8f83\u4e3a\u5e38\u7528\u7684\u7684CSS hack\uff0c\u6574\u7406\u51fa\u4e00\u4e2a<strong>Windows\u7cfb\u7edf\u4e0b\u5404\u6d4f\u89c8\u5668\u5e38\u7528CSS hack\u6c47\u603b\u8868<\/strong>\uff0c\u5982\u4e0b\uff1a<br \/>\n<span style=\"font-size: 12px; line-height: 18px\">\u8bf4\u660e\uff1a<br \/>\n1. \u6b64\u6c47\u603b\u8868\u4e2d\u6d4b\u8bd5\u6d4f\u89c8\u5668\u7684\u7248\u672c\u4e3a<br \/>\no IE6<br \/>\no IE7<br \/>\no IE8<br \/>\no Firefox 3.6.6<br \/>\no Safari 5.0<br \/>\no Chrome 6.0.458.1 dev<br \/>\no Opera 10.60<br \/>\n2. \u5176\u4e2d\uff0c\u591a\u6570CSS hack\u662f\u5728selector{property:value;}\u57fa\u7840\u4e0a\u66f4\u6539\u7684\u3002selector\u4ee3\u8868CSS\u9009\u62e9\u5668\uff0cproperty\u4ee3\u8868CSS\u7279\u6027\uff0cvalue\u4ee3\u8868\u7279\u6027\u7684\u503c\u3002<br \/>\n3. FF\u4ee3\u8868Firefox\uff0cCh\u4ee3\u8868Chorme\uff0cSa\u4ee3\u8868Safari\uff0cOp\u4ee3\u8868Opera<br \/>\n4. Q\u4ee3\u8868Quirks Mode\uff0cS\u4ee3\u8868Standards Mode\u3002<br \/>\n5. Hack Type\u5217\u7684\u6570\u5b57\uff0c\u6307\u7684\u662f\u4e0a\u9762CSS hack\u7684\u5b9e\u73b0\u65b9\u5f0f\u4e2d\u7684\u5217\u8868\u53f7\u30021\u662f\u6307&ldquo;\u5229\u7528\u6d4f\u89c8\u5668\u5bf9\u76f8\u540c\u4ee3\u7801\u7684\u89e3\u6790\u548c\u652f\u6301\u7684\u4e0d\u540c\u5b9e\u73b0\u7684hack&rdquo;\uff0c2\u662f\u6307\u4ee5Firefox\u6216Webkit\u7279\u6709\u7684\u6269\u5c55\u6837\u5f0f\u5b9e\u73b0\u7684hack\u3002<\/span><br \/>\n<img decoding=\"async\" alt=\"\" src=\"https:\/\/lh3.googleusercontent.com\/m26oxz80jSFz_l1sAjvQN0igdE9uMbjlXyAUGZhSHU3EJyA-bNGGC7jUnsFlZYB8mnpp1FeKhS9mOFKEp1JFuaKlgjbSA01baNR_OmpyUdZDaJW5\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" \/><br \/>\n\u5176\u4e2d *+html selector \u7684\u6d4b\u8bd5\u7528\u4f8b\uff1a<br \/>\n&nbsp;<\/p>\n<dl class=\"code\" style=\"padding-right: 0px; overflow-y: auto; padding-left: 0px; font-size: 12px; overflow-x: auto; padding-bottom: 0px; margin: 0px; width: 718px; padding-top: 0px\">\n<dt style=\"font-weight: bold; color: rgb(51,51,51); text-indent: 6px; line-height: 24px; height: 24px; background-color: rgb(245,245,245)\">HTML code<\/dt>\n<dd style=\"border-right: rgb(221,221,221) 1px solid; border-top: rgb(221,221,221) 1px solid; margin: 0px; border-left: rgb(221,221,221) 1px solid; border-bottom: rgb(221,221,221) 1px solid\">\n<pre><div><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">style <\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">type<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">=&quot;text\/css&quot;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><span style=\"color: rgb(128,0,0); line-height: 18px; background-color: rgb(245,245,245)\">\r\n   *+html #test <\/span><span style=\"color: rgb(0,0,0); line-height: 18px; background-color: rgb(245,245,245)\">{<\/span><span style=\"color: rgb(255,0,0); line-height: 18px; background-color: rgb(245,245,245)\">\r\n       color<\/span><span style=\"color: rgb(0,0,0); line-height: 18px; background-color: rgb(245,245,245)\">:<\/span><span style=\"color: rgb(0,0,255); line-height: 18px; background-color: rgb(245,245,245)\"> red<\/span><span style=\"color: rgb(0,0,0); line-height: 18px; background-color: rgb(245,245,245)\">;<\/span><span style=\"color: rgb(255,0,0); line-height: 18px; background-color: rgb(245,245,245)\">\r\n   <\/span><span style=\"color: rgb(0,0,0); line-height: 18px; background-color: rgb(245,245,245)\">}<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;\/<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">style<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">h1 <\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">id<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">=&quot;test&quot;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">TEXT<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;\/<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">h1<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><\/div>\r\n<\/pre>\n<\/dd>\n<\/dl>\n<p>\u5176\u4ed6\u6d4b\u8bd5\u7528\u4f8b\u53ef\u5728\u6b64\u57fa\u7840\u4e0a\u4fee\u6539\u3002<\/p>\n<p>\u5207\u8bb0\uff0c\u9075\u5b88CSS hack\u7684\u4e09\u6761\u539f\u5219\u3002CSS hack\u662f\u6ca1\u6709\u529e\u6cd5\u7684\u65f6\u5019\u624d\u4f7f\u7528\u7684\u89e3\u51b3\u517c\u5bb9\u6027\u95ee\u9898\u7684\u62db\u672f\uff0c\u662f\u7528\u517c\u5bb9\u6027\u95ee\u9898\u53bb\u89e3\u51b3\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u65e0\u5f02\u4e8e\u996e\u9e29\u6b62\u6e34\u3002\u5207\u83ab\u4e00\u6709\u517c\u5bb9\u6027\u95ee\u9898\u5c31\u4f7f\u7528\u3002<br \/>\n\u53e6\u5916\uff0c\u65f6\u523b\u8bb0\u5f97\u6539\u6389\u7528CSS hack\u4fee\u8865\u7684\u95ee\u9898\u3002<\/p>\n<p>\u8865\u5145\u4e00\u70b9\u513f\u597d\u73a9\u513f\u7684\u4e1c\u897f\uff0cYahoo\u4e5f\u6709\u4e00\u79cd\u5b9e\u73b0hack\u7684\u65b9\u5f0f\uff0c\u6bd4\u8f83\u7279\u6b8a\u3002Yahoo\u4f1a\u5229\u7528\u670d\u52a1\u5668\u53bb\u5224\u65ad\u6253\u5f00\u5176\u9875\u9762\u7684\u6d4f\u89c8\u5668\u7684\u7c7b\u522b\uff0c\u7136\u540e\uff0c\u628a\u4fe1\u606f\u52a0\u5230HTML\u6807\u7b7e\u4e0a\uff0c\u6bd4\u5982\u6211\u4f7f\u7528Firefox\u6253\u5f00Yahoo\u7684\u9996\u9875\uff0c\u67e5\u770b\u5b83\u7684HTML\u6807\u7b7e\uff0c\u53d1\u73b0\uff1a<br \/>\n&nbsp;<\/p>\n<dl class=\"code\" style=\"padding-right: 0px; overflow-y: auto; padding-left: 0px; font-size: 12px; overflow-x: auto; padding-bottom: 0px; margin: 0px; width: 718px; padding-top: 0px\">\n<dt style=\"font-weight: bold; color: rgb(51,51,51); text-indent: 6px; line-height: 24px; height: 24px; background-color: rgb(245,245,245)\">HTML code<\/dt>\n<dd style=\"border-right: rgb(221,221,221) 1px solid; border-top: rgb(221,221,221) 1px solid; margin: 0px; border-left: rgb(221,221,221) 1px solid; border-bottom: rgb(221,221,221) 1px solid\">\n<pre><div><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">html <\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">lang<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">=&quot;en-US&quot;<\/span><span style=\"color: rgb(255,0,0); line-height: 18px\"> class<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">=&quot;y-fp-bg y-fp-pg-grad ua-ff ua-win ua-ff3_6  bkt701&quot;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">&hellip;&hellip;<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&lt;\/<\/span><span style=\"color: rgb(128,0,0); line-height: 18px\">html<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\">&gt;<\/span><\/div>\r\n<\/pre>\n<\/dd>\n<\/dl>\n<p>\u6ce8\u610f\u5176\u4e2d\u7684ua-ff ua-win ua-ff3_6\uff0c\u542b\u6709\u6d4f\u89c8\u5668\u7c7b\u522b\u548c\u7248\u672c\u7684\u4fe1\u606f\u3002<br \/>\n\u7136\u540e\uff0c\u5728\u8bbe\u7f6e\u7279\u5b9a\u6d4f\u89c8\u5668\u7684\u6837\u5f0f\u65f6\uff0c\u6bd4\u5982\uff0c\u6211\u5e0c\u671b\u5728Firefox\u91cc\u8ba9\u6240\u6709\u7684div\u4e2d\u7684\u6587\u5b57\u90fd\u662f\u7ea2\u8272\uff0c\u53ef\u4ee5\u8fd9\u6837\u8bbe\u7f6e\uff1a<br \/>\n&nbsp;<\/p>\n<dl class=\"code\" style=\"padding-right: 0px; overflow-y: auto; padding-left: 0px; font-size: 12px; overflow-x: auto; padding-bottom: 0px; margin: 0px; width: 718px; padding-top: 0px\">\n<dt style=\"font-weight: bold; color: rgb(51,51,51); text-indent: 6px; line-height: 24px; height: 24px; background-color: rgb(245,245,245)\">CSS code<\/dt>\n<dd style=\"border-right: rgb(221,221,221) 1px solid; border-top: rgb(221,221,221) 1px solid; margin: 0px; border-left: rgb(221,221,221) 1px solid; border-bottom: rgb(221,221,221) 1px solid\">\n<pre><div><span style=\"color: rgb(128,0,0); line-height: 18px\">.ua-ff div<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">{<\/span><span style=\"color: rgb(255,0,0); line-height: 18px\">\r\ncolor <\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">:<\/span><span style=\"color: rgb(0,0,255); line-height: 18px\"> red<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">;<\/span><span style=\"color: rgb(0,0,0); line-height: 18px\">}<\/span><\/div>\r\n<\/pre>\n<\/dd>\n<\/dl>\n<p>\u5443\uff5e\uff5e\uff0c\uff0c\u6211\u89c9\u5f97\u8fd9\u4e5f\u53ef\u4ee5\u53eb\u505aCSS hack\u3002<br \/>\n<a rel=\"nofollow\" href=\"http:\/\/topic.csdn.net\/u\/20100705\/09\/d270754c-6f5d-4864-84b2-5d4013ca3cd3.html?27279\">http:\/\/topic.csdn.net\/u\/20100705\/09\/d270754c-6f5d-4864-84b2-5d4013ca3cd3.html?27279<\/a>\u66f4\u591a\u67e5\u9605\u8bf7\u770b\u8fd9\u4e2a\u5730\u5740<\/p>\n<p><\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60CSS\uff0c\u9664\u4e86\u57fa\u7840\uff0c\u8fd8\u6709\u5fc5\u5b66\u7684\u4e00\u8bfe\uff0c\u5c31\u662fCSS hack\uff0c\u5f88\u591a\u4e66\u7c4d\u4e0a\u90fd\u6709\u6d89\u53ca\u3002\u5f53\u65f6\u89c9\u5f97\u8fd9\u4e2a\u4e1c\u897f\u5f88\u795e\u79d8\uff0c\u53ef\u4ee5\u9488\u5bf9\u67d0\u4e2a\u6216\u67d0\u4e9b\u6d4f\u89c8\u5668\u5199\u4e9b\u7279\u522b\u7684 CSS \u6837\u5f0f\u800c\u4e0d\u5f71\u54cd\u5176\u4ed6\uff0c\u800c\u4e14\u7528\u8d77\u6765\u4e5f\u5f88\u65b9\u4fbf\u3002 \u867d\u7136\u5982\u6b64\uff0c\u4f46\u662f\uff0c\u5f88\u5c11\u6709\u4eba\u77e5\u9053\uff0c\u5b83\u5230\u5e95\u662f\u4ec0\u4e48\u4e1c\u897f\uff0c\u4f7f\u7528&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1],"tags":[],"topic":[],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-htmlcss","category-technology"],"_links":{"self":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":1,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":66284,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions\/66284"}],"wp:attachment":[{"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/tags?post=640"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/www.xiaoyebailong.com\/index.php\/wp-json\/wp\/v2\/topic?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}