{"id":9250,"date":"2020-02-12T22:18:51","date_gmt":"2020-02-12T14:18:51","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9250"},"modified":"2022-02-05T22:16:48","modified_gmt":"2022-02-05T14:16:48","slug":"css-supports-selector","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/02\/css-supports-selector\/","title":{"rendered":"CSS @supports\u5f00\u59cb\u652f\u6301selector\u9009\u62e9\u5668\u68c0\u6d4b\u4e86"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9250\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9250<\/a><br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202002-supports-selector.png';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/css-supports-selector.jpg\" width=\"480\" height=\"301\" class=\"alignright clip thumb size-medium\" alt=\"@supports\u89c4\u5219\u9009\u62e9\u5668\u8bed\u6cd5\" \/><\/p>\n<p>CSS @supports\u89c4\u5219\u5df2\u7ecf\u5f00\u59cb\u652f\u6301<code>selector<\/code>\u9009\u62e9\u5668\u68c0\u6d4b\u4e86\uff0c\u8fd9\u4e2a\u5b9e\u5728\u662f\u592a\u6e9c\u6e9c\u6e9c\u4e86\uff0c\u5f88\u591aCSS Selector Level 4\u7684\u9009\u62e9\u5668\u7684\u4f7f\u7528\u53ef\u4ee5\u66f4\u7b80\u5355\u4e86\u3002<\/p>\n<h3>\u4e00\u3001\u8bed\u6cd5\u548c\u6848\u4f8b<\/h3>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>@supports selector(\u9009\u62e9\u5668) {\r\n   <span style=\"color:green;\">\/* CSS rules here *\/<\/span>\r\n}<\/pre>\n<p>\u5f53\u7136\u4e5f\u652f\u6301<code>not<\/code>\u3001<code>and<\/code>\u548c<code>or<\/code>\u7b49\u64cd\u4f5c\u7b26\u3002<\/p>\n<p>\u4e00\u4e9b\u4f7f\u7528\u6848\u4f8b\uff1a<\/p>\n<h4>1. \u5f53\u524d\u6d4f\u89c8\u5668\u662f\u5426\u652f\u6301\u7684\u5224\u65ad<\/h4>\n<style>.result-a:before {    content: '\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301selector()\u8bed\u6cd5'; padding: 5px;    border: solid;color: red;}@supports selector(span) {    .result-a:before {content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5';        color: green;    }}@supports selector(:default) {    .result-b:before {  content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5\uff0c\u540c\u65f6\u652f\u6301:default\u4f2a\u7c7b';  color: green;        padding: 5px;        border: solid;    }}.result-c:before {\n    padding: 5px;\n    border: solid;\n    color: red;\n    content: '\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301selector()\u8bed\u6cd5\uff0c\u65e0\u6cd5\u5224\u65ad\u662f\u5426\u652f\u6301:target-within\u4f2a\u7c7b'; \n}\n@supports not selector(:target-within) {\n    .result-c:before {\n        content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5\uff0c\u4f46\u662f\u4e0d\u652f\u6301:target-within\u4f2a\u7c7b';    \n    }\n}<\/style>\n<pre>.result-a:before {\r\n    content: '\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301selector()\u8bed\u6cd5';\r\n    color: red;\r\n    padding: 5px;\r\n    border: solid;\r\n}\r\n<span style=\"color:green;\">\/* span\u6807\u7b7e\u9009\u62e9\u5668\u6240\u6709\u6d4f\u89c8\u5668\u90fd\u652f\u6301\uff0c\u53ef\u4ee5\u7528\u6765\u5224\u65adselector()\u8bed\u6cd5\u7684\u652f\u6301\u60c5\u51b5 *\/<\/span>\r\n@supports selector(span) {\r\n    .result-a:before {\r\n        content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5';\r\n        color: green;\r\n    }\r\n}<\/pre>\n<p>\u4e0a\u9762CSS\u4ee3\u7801\u7684\u5b9e\u9645\u6548\u679c\u5982\u4e0b\uff0c\u5982\u679c\u60a8\u5f53\u524d\u8bbf\u95ee\u7684\u6d4f\u89c8\u5668\u5e76\u4e0d\u652f\u6301<code>selector()<\/code>\u8bed\u6cd5\uff0c\u5219\u4e0b\u9762\u4f1a\u663e\u793a\u7ea2\u8272\u7684\u4e0d\u652f\u6301\u6587\u5b57\uff0c\u5982\u679c\u60a8\u5f53\u524d\u8bbf\u95ee\u7684\u6d4f\u89c8\u5668\u652f\u6301<code>selector()<\/code>\u8bed\u6cd5\uff0c\u5219\u663e\u793a\u7684\u4f1a\u662f\u7eff\u8272\u7684\u6587\u5b57\u3002<\/p>\n<p><span class=\"result-a\"><\/span><\/p>\n<h4>2. \u4f2a\u7c7b\u662f\u5426\u652f\u6301\u7684\u5224\u65ad<\/h4>\n<pre><span style=\"color:green;\">\/* \u5982\u679c\u652f\u6301:default\u4f2a\u7c7b\u600e\u6837\u600e\u6837... *\/<\/span>\r\n@supports selector(:default) {\r\n    .result-b:before {\r\n        content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5\uff0c\u540c\u65f6\u652f\u6301:default\u4f2a\u7c7b';\r\n        color: green;\r\n        padding: 5px;\r\n        border: solid;\r\n    }\r\n}<\/pre>\n<p>\u5982\u679c\u4f60\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301<code>selector()<\/code>\u8bed\u6cd5\uff0c\u540c\u65f6\u652f\u6301<code>:default<\/code>\u4f2a\u7c7b\uff0c\u5219\u4e0b\u9762\u4f1a\u770b\u5230\u63d0\u793a\u5185\u5bb9\u3002<\/p>\n<p><span class=\"result-b\"><\/span><\/p>\n<p>\u4f8b\u5982\u5728Firefox\u6d4f\u89c8\u5668\u4e0b\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-12_204659.png\" width=\"558\" height=\"152\" alt=\"Firefox\u6d4f\u89c8\u5668\u4e0b\u622a\u56fe\" class=\"alignnone size-medium\" \/><\/p>\n<h4>3. \u903b\u8f91\u64cd\u4f5c\u7b26\u4f7f\u7528\u6848\u4f8b\u793a\u610f<\/h4>\n<pre>\r\n.result-c:before {\r\n    padding: 5px;\r\n    border: solid;\r\n    color: red;\r\n    content: '\u5f53\u524d\u6d4f\u89c8\u5668\u4e0d\u652f\u6301selector()\u8bed\u6cd5\uff0c\u65e0\u6cd5\u5224\u65ad\u662f\u5426\u652f\u6301:target-within\u4f2a\u7c7b'; \r\n}\r\n<span style=\"color:green;\">\/* \u5982\u679c\u4e0d\u652f\u6301:target-within\u4f2a\u7c7b\u600e\u6837\u600e\u6837... *\/<\/span>\r\n@supports not selector(:target-within) {\r\n    .result-c:before {\r\n        content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5\uff0c\u4f46\u662f\u4e0d\u652f\u6301:target-within\u4f2a\u7c7b';    \r\n    }\r\n}<\/pre>\n<p>\u5b9e\u65f6\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n<p><span class=\"result-c\"><\/span><\/p>\n<p>\u7ed3\u679c\u5f88\u51fa\u4eba\u610f\u6599\u7684\uff0cChrome\u6d4f\u89c8\u5668\u4e0b\u5c45\u7136\u63d0\u793a\u201c\u652f\u6301selector()\u8bed\u6cd5\u201d\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-12_210424.png\" width=\"551\" height=\"139\" alt=\"Chrome\u6d4f\u89c8\u5668\u4e0b\u5c45\u7136\u8bed\u6cd5\u6ca1\u62a5\u9519\" class=\"alignnone size-medium\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-12_210208.png\" width=\"463\" height=\"254\" alt=\"Chrome\u6d4f\u89c8\u5668\u53ef\u4ee5\u8bc6\u522b\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u540e\u6765\u4e00\u6d4b\u8bd5\u53d1\u73b0\uff0c@supports\u89c4\u5219\u652f\u6301\u7684\u8bed\u6cd5\u51fd\u6570\u5e76\u4e0d\u4e00\u5b9a\u975e\u8981\u662f<code>selector()<\/code>\uff0c\u4efb\u610f\u7684\u90fd\u53ef\u4ee5\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><span style=\"color:green;\">\/* \u8bed\u6cd5OK *\/<\/span>\r\n@supports a(b) {}<\/pre>\n<p>\u4e0a\u9762\u8fd9\u4e2a\u4e0d\u77e5\u9053\u4ec0\u4e48\u9b3c\u7684<code>a(b)<\/code>\u5224\u65ad\u6761\u4ef6\uff0cChrome\u548cFirefox\u90fd\u4f1a\u8ba4\u4e3a\u8fd9\u4e2a\u8bed\u6cd5\u662f\u5408\u6cd5\u7684\uff0c\u4f46\u662f\u7531\u4e8e\u6ca1\u6709\u4efb\u4f55\u6d4f\u89c8\u5668\u5339\u914d\u8fd9\u4e2a\u5224\u65ad\u6761\u4ef6\uff0c\u56e0\u6b64\u82b1\u62ec\u53f7\u91cc\u9762\u7684CSS\u662f\u7edd\u5bf9\u4e0d\u4f1a\u4e0d\u5e94\u7528\u3002<\/p>\n<p>\u4f46\u662f\u5982\u679c\u6211\u4eec\u4f7f\u7528\u7684\u662f<code>not<\/code>\u64cd\u4f5c\u7b26\uff0c\u90a3\u60c5\u51b5\u5c31\u5927\u4e0d\u4e00\u6837\u4e86\u3002<\/p>\n<pre><span style=\"color:green;\">\/* Chrome\u548cFirefox\u90fd\u4f1a\u5224\u65ad\u901a\u8fc7 *\/<\/span>\r\n@supports not a(b) {}<\/pre>\n<p>\u56e0\u6b64\uff0c\u6211\u4eec\u4f7f\u7528<code>not<\/code>\u64cd\u4f5c\u7b26\u7684\u65f6\u5019\u5e94\u8be5\u8fd9\u6837\u5199\u624d\u884c\uff1a<\/p>\n<pre>\r\n@supports (not selector(:target-within)) and selector(a) {\r\n    .result-c:before {\r\n        content: '\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301selector()\u8bed\u6cd5\uff0c\u4f46\u662f\u4e0d\u652f\u6301:target-within\u4f2a\u7c7b';    \r\n    }\r\n}<\/pre>\n<h4>4. \u66f4\u590d\u6742\u7684\u9009\u62e9\u5668<\/h4>\n<pre>@supports selector(:nth-child(1n of a, b)) {\r\n    <span style=\"color:green;\">\/* \u5f53:is(\u2026)\u9009\u62e9\u5668\u548c:nth-child(\u2026)\u9009\u62e9\u5668\u540c\u65f6\u652f\u6301\u7684\u65f6\u5019CSS\u624d\u4f1a\u88ab\u5e94\u7528 *\/<\/span>\r\n    :is(:nth-child(1n of ul, ol) a, details > summary) {\r\n       \u2026 \r\n    }\r\n}<\/pre>\n<h3>\u517c\u5bb9\u6027<\/h3>\n<p>\u76ee\u524d\u4ec5Firefox\u6d4f\u89c8\u5668\u4e00\u9a91\u7ea2\u5c18\uff0c\u4e00\u9a6c\u5f53\u5148\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-12_212927.png\" width=\"646\" height=\"343\" alt=\"Firefox\u6d4f\u89c8\u5668\u4e00\u9a6c\u5f53\u5148\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u6240\u4ee5\u672c\u6587\u8fd8\u662f\u86ee\u8d85\u524d\u7684\uff0c\u54c8\u54c8\u54c8\u3002<\/p>\n<p><strong>\u66f4\u65b0\u4e8e 20222-02-25<\/strong><\/p>\n<p>\u73b0\u5728\u4e3b\u6d41\u7684\u6d4f\u89c8\u5668\u90fd\u5df2\u7ecf\u652f\u6301\u4e86\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202202\/2022-02-05_221333.png\" width=\"469\" height=\"225\" alt=\"supports selector() \u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u517c\u5bb9\u6027\u67e5\u8be2\u5730\u5740\uff1a<a href=\"https:\/\/caniuse.com\/mdn-css_at-rules_supports_selector\" rel=\"noopener\" target=\"_blank\">\u70b9\u6211<\/a>\u3002<\/p>\n<h3>@supports\u89c4\u5219\u57fa\u672c\u7528\u6cd5<\/h3>\n<p>@supports\u89c4\u5219\u57fa\u672c\u7528\u6cd5\u662f\u7528\u6765\u5224\u65adCSS\u58f0\u660e\u7684\u77e5\u5426\u652f\u6301\u7684\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><span style=\"color:green\">\/* \u652f\u6301Flex\u5e03\u5c40 *\/<\/span>\r\n@supports (display: flex) {}\r\n<span style=\"color:green\">\/* \u4e0d\u652f\u6301Flex\u5e03\u5c40 *\/<\/span>\r\n@supports not (display: flex) {}\r\n<span style=\"color:green\">\/* \u540c\u65f6\u652f\u6301Flex\u5e03\u5c40\u548cGrid\u5e03\u5c40 *\/<\/span>\r\n@supports (display: flex) and (display: grid) {}\r\n<span style=\"color:green\">\/* \u652f\u6301Flex\u5e03\u5c40\u6216\u8005\u652f\u6301Grid\u5e03\u5c40 *\/<\/span>\r\n@supports (display: flex) or (display: grid)  {}<\/pre>\n<p>\u751a\u81f3\u8fde\u7eed\u5224\u65ad\u4e09\u4e2a\u4ee5\u4e0a\u7684CSS\u58f0\u660e\u4e5f\u6ca1\u95ee\u9898\uff1a<\/p>\n<pre><span style=\"color:green\">\/* \u5408\u6cd5 *\/<\/span>\r\n@supports (display: flex) and (display: grid) and (gap: 0) {}\r\n@supports (display: flex) or (display: grid) or (gap: 0) {}<\/pre>\n<p>\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;supports-condition&gt; = ( &lt;var&gt; ) <strong class=\"blue\">|<\/strong> not ( &lt;var&gt; ) <strong class=\"blue\">|<\/strong> ( &lt;var&gt; ) [ and (&lt;var&gt;) ]+ <strong class=\"blue\">|<\/strong> ( &lt;var&gt; ) [ or (&lt;var&gt;) ]+<\/pre>\n<p>\u53ef\u4ee5\u770b\u51fa\u4e0b\u9762\u51e0\u4e2a\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u5982\u679c\u90fd\u662fand\u64cd\u4f5c\u7b26\uff0c\u53ef\u4ee5\u65e0\u9650\u6781\u8fde<\/li>\n<li>\u5982\u679c\u90fd\u662for\u64cd\u4f5c\u7b26\uff0c\u53ef\u4ee5\u65e0\u9650\u6781\u8fde<\/li>\n<li>and\u548cor\u64cd\u4f5c\u7b26\u4e0d\u80fd\u76f4\u63a5\u6df7\u7528\uff0cand\u548cnot\u64cd\u4f5c\u7b26\u4e0d\u80fd\u76f4\u63a5\u6df7\u7528\uff0cor\u548cnot\u64cd\u4f5c\u7b26\u4e0d\u80fd\u76f4\u63a5\u6df7\u7528\u3002<\/li>\n<\/ul>\n<p>\u590d\u6742\u903b\u8f91@supports\u89c4\u5219\u7684\u64cd\u4f5c\u7b26\u5d4c\u5957\u89c4\u5219\u5176\u5b9e\u5f88\u7b80\u5355\uff1a\u5408\u6cd5\u7684\u903b\u8f91\u8bed\u53e5\u653e\u5728\u5408\u6cd5\u7684\u903b\u8f91\u8bed\u53e5\u7684\u62ec\u53f7\u91cc\u4e0d\u65ad\u5d4c\u5957\uff01<\/p>\n<p>\u8bed\u6cd5\u8868\u793a\u5c31\u662f\uff1a<\/p>\n<pre>&lt;var&gt; = &lt;declaration&gt; | <strong>&lt;supports-condition&gt;<\/strong><\/pre>\n<p>\u4f8b\u5982\uff0c\u201c\u5224\u65ad\u5f53\u524d\u6d4f\u89c8\u5668\u652f\u6301Flex\u5e03\u5c40\uff0c\u4f46\u4e0d\u652f\u6301Grid\u5e03\u5c40\u201d\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u53ef\u4ee5\u5148\u628a\u6b63\u786e\u7684\u57fa\u7840\u8bed\u6cd5\u5199\u597d\uff1a<\/p>\n<pre>@supports (display: flex) and (\u4e0d\u652f\u6301Grid\u5e03\u5c40)  {}<\/pre>\n<p>\u7136\u540e\u201c\u4e0d\u652f\u6301Grid\u5e03\u5c40\u201d\u7684\u57fa\u7840\u8bed\u6cd5\u662f<code>not (display: grid)<\/code>\uff0c\u8bed\u6cd5\u5d4c\u5957\u4e0b\uff08\u66ff\u6362\u62ec\u53f7\u91cc\u9762\u7684\u5185\u5bb9\uff09\uff0c\u4e8e\u662f\u5f97\u5230\u6b63\u786e\u7684\u5199\u6cd5\uff1a<\/p>\n<pre>@supports (display: flex) and (not (display: grid))  {}<\/pre>\n<p>Edge12-Edge15\u6d4f\u89c8\u5668\u6b63\u597d\u662f\u7b26\u5408\u4e0a\u9762\u7684\u6761\u4ef6\u5224\u65ad\u7684\uff0c\u6211\u4eec\u4e0d\u59a8\u9a8c\u8bc1\u4e0b\uff1a<\/p>\n<pre>&lt;span class=\"supports-match\"&gt;\u5982\u679c\u6709\u80cc\u666f\u8272\uff0c\u5219\u662f\u5339\u914d&lt;\/span&gt;<\/pre>\n<pre>.supports-match {\r\n    padding: 5px;\r\n    border: 1px solid;\r\n}\r\n@supports (display: flex) and (not (display: grid))  {\r\n    .supports-match {\r\n        background-color: #333;\r\n        color: #fff;\r\n    }\r\n}<\/pre>\n<p>\u7ed3\u679c\u5728Edge14\u6d4f\u89c8\u5668\u4e0b\u7684\u6548\u679c\u5982\u4e0b\u56fe\uff0cChrome\u6d4f\u89c8\u5668\u4e0b\u5219\u53ea\u6709\u8fb9\u6846\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202002\/2-9_support-not.png\" loading=\"lazy\" width=\"164\" height=\"28\" alt=\"Edge14\u6d4f\u89c8\u5668\u4e0b\u7684\u6587\u5b57\u6837\u5f0f\u622a\u56fe\"><\/p>\n<p>@supports\u89c4\u5219\u8fd8\u652f\u6301CSS\u81ea\u5b9a\u4e49\u5c5e\u6027\uff08CSS\u53d8\u91cf\uff09\u7684\u68c0\u6d4b\u5224\u65ad\u652f\u6301\uff1a<\/p>\n<pre>@supports (--var: blue) {}<\/pre>\n<p>\u4e0d\u8fc7\u5c31\u662f\u5b9e\u9645\u5f00\u53d1\u7684\u65f6\u5019\uff0c\u5c31\u7b97\u5224\u65ad\u4e86\u4e5f\u6ca1\u4ec0\u4e48\u7528\u3002<\/p>\n<h3>\u7ed3\u675f\u8bed<\/h3>\n<p>CSS @supports\u5f00\u59cb\u652f\u6301selector\u9009\u62e9\u5668\u68c0\u6d4b\u5566\uff0c\u4e0d\u8fc7\u76ee\u524d\u53ea\u6709Firefox\u6d4f\u89c8\u5668\u652f\u6301\uff0c\u56e0\u6b64\u8fd9\u4e2a\u65b0\u7279\u6027\u867d\u7136\u8ba9\u4eba\u6fc0\u52a8\uff0c\u4f46\u662f\u5f88\u9057\u61be\u5374\u4e0d\u80fd\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u4f7f\u7528\uff0c\u6bd5\u7adfFirefox\u6d4f\u89c8\u5668\u5728\u5b9e\u9645\u73af\u5883\u4e2d\u7684\u5360\u6bd4\u592a\u4f4e\u4e86\u3002<\/p>\n<p>\u600e\u4e48\u529e\u5462\uff0c\u6ca1\u529e\u6cd5\uff0c\u53ea\u80fd\u7b49\u554a\u7b49\u554a\u7b49\uff0c\u7b49chrome\u6d4f\u89c8\u5668\u4ec0\u4e48\u65f6\u5019\u652f\u6301\u6211\u4eec\u5c31\u53ef\u4ee5\u770b\u5230\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u5e94\u7528\u7684\u66d9\u5149\u4e86\u3002<\/p>\n<p>\u4e0d\u8fc7\u76ee\u524dCSS @supports\u89c4\u5219\u7684\u8bed\u6cd5\u5012\u662f\u53ef\u4ee5\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u4f7f\u7528\uff0c\u5c24\u5176\u5728\u79fb\u52a8\u7aef\uff0c\u5f88\u591a\u65b0\u7684\u6027\u80fd\u6211\u4eec\u53ef\u4ee5\u7528\u6765\u68c0\u6d4b\uff0c\u7136\u540e\u505a\u6e10\u8fdb\u589e\u5f3a\u6216\u4f18\u96c5\u964d\u7ea7\u5904\u7406\u3002<\/p>\n<p>Edge12+\u652f\u6301\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/2020-02-12_214446.png\" width=\"638\" height=\"278\" alt=\"@supports\u57fa\u7840\u8bed\u6cd5\u7684\u517c\u5bb9\u6027\u622a\u56fe\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u597d\uff0c\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5185\u5bb9\uff0c\u611f\u8c22\u5927\u5bb6\u9605\u8bfb\uff0c\u5982\u679c\u4f60\u89c9\u5f97\u4e0d\u9519\uff0c\u6b22\u8fce\u5206\u4eab\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/emtion\/emoji\/2764.svg\" width=\"20\" height=\"20\" align=\"absmiddle\"><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=9250\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=9250<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/202002\/css-supports-selector.jpg\" width=\"160\" height=\"100\" class=\"alignright size-medium\" alt=\"@supports\u89c4\u5219\u9009\u62e9\u5668\u8bed\u6cd5\" \/><\/p>\n<p>CSS @supports\u89c4\u5219\u73b0\u5728\u4e0d\u4ec5\u652f\u6301CSS\u65b0\u7684\u5c5e\u6027\u6216\u8005\u5c5e\u6027\u503c\u7684\u68c0\u6d4b\uff0c\u8fd8\u652f\u6301selector\u9009\u62e9\u5668\u7684\u68c0\u6d4b\uff0c\u771f\u662f\u8d8a\u6765\u8d8a\u5f3a\u5927\u4e86\uff0c\u8bed\u6cd5\u5f88\u7b80\u5355\uff0c\u4f46\u662f\u8fd8\u662f\u6709\u4e00\u4e9b\u9700\u8981\u6ce8\u610f\u7684\u7ec6\u8282\u77e5\u8bc6\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[1220,1459,1559,1012,605,1558,212],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9250"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=9250"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/9250\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=9250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=9250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=9250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}