{"id":53164,"date":"2024-12-03T13:11:43","date_gmt":"2024-12-03T05:11:43","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53164\/"},"modified":"2024-12-03T13:11:43","modified_gmt":"2024-12-03T05:11:43","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-css-%e5%aa%92%e4%bd%93%e6%9f%a5%e8%af%a2%e4%b8%ad%e5%8e%bb%e9%99%a4%e8%83%8c%e6%99%af%e5%9b%be%e6%95%88%e6%9e%9c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53164\/","title":{"rendered":"\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p>\u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241127\/17327039876746f6f39e429.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>CSS \u5a92\u4f53\u67e5\u8be2\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c<\/strong><\/p>\n<p>\u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u9700\u8981\u6839\u636e\u4e0d\u540c\u8bbe\u5907\u5c4f\u5e55\u5c3a\u5bf8\u6765\u4fee\u6539\u6837\u5f0f\u7684\u9700\u6c42\u3002\u5176\u4e2d\uff0c\u79fb\u9664\u80cc\u666f\u56fe\u6548\u679c\u662f\u4e00\u4e2a\u5e38\u89c1\u95ee\u9898\u3002<\/p>\n<p>\u4ee5\u4e0b HTML \u548c CSS \u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u5728 768px \u4ee5\u4e0b\u5c4f\u5e55\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1a<\/p>\n<pre>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n    &lt;head&gt;\n        &lt;meta charset=\"utf-8\"&gt;\n        &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"&gt;\n        &lt;meta http-equiv=\"x-ua-compatible\" content=\"ie=edge\"&gt;\n        &lt;title&gt;&lt;\/title&gt;\n    &lt;\/head&gt;\n    &lt;body&gt;\n        &lt;style type=\"text\/css\"&gt;\n            #test {\n                background-image: url(\u65e0\u6807\u9898.png);\n                background-repeat: no-repeat;\n                width: 100%;\n                height: 500px;\n            }\n\n            @media (max-width: 768px) {\n                #test {\n                    background-image: none;\n                }\n            }\n        &lt;\/style&gt;\n        &lt;div id=\"test\"&gt;\n            &lt;div style=\"width: 100px;height: 700px; background-color: red;\"&gt;\n            &lt;\/div&gt;\n        &lt;\/div&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<p>\u539f\u672c\uff0c\u8fd9\u6bb5 CSS \u4f7f\u7528\u5a92\u4f53\u67e5\u8be2\u4e3a\u5c4f\u5e55\u5bbd\u5ea6\u5c0f\u4e8e\u6216\u7b49\u4e8e 768px \u65f6\u8bbe\u7f6e #test \u5143\u7d20\u7684\u80cc\u666f\u56fe\u4e3a\u7a7a (background-image: none)\uff0c\u4ee5\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\u3002\u7136\u800c\uff0c\u8fd9\u6bb5\u4ee3\u7801\u5e76\u672a\u751f\u6548\uff0c\u56e0\u4e3a\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4e00\u822c CSS \u6837\u5f0f\u4f18\u5148\u7ea7\u6bd4\u5a92\u4f53\u67e5\u8be2\u6837\u5f0f\u66f4\u9ad8\u3002<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\u662f\u5c06\u5a92\u4f53\u67e5\u8be2\u6837\u5f0f\u653e\u5728\u5e38\u89c4 CSS \u6837\u5f0f\u540e\u9762\uff0c\u4ee5\u63d0\u9ad8\u5176\u4f18\u5148\u7ea7\u3002\u4fee\u6539\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>#test {\n    background-image: url(\u65e0\u6807\u9898.png);\n    background-repeat: no-repeat;\n    width: 100%;\n    height: 500px;\n}\n\n@media (max-width: 768px) {\n    #test {\n        background-image: none;\n    }\n}<\/pre>\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5c31\u53ef\u4ee5\u5728\u5c4f\u5e55\u5bbd\u5ea6\u5c0f\u4e8e\u6216\u7b49\u4e8e 768px \u65f6\u6709\u6548\u53bb\u9664 #test \u80cc\u666f\u56fe\u6548\u679c\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\u4e86\uff0c\u662f\u5426\u6709\u987a\u5229\u5e2e\u52a9\u4f60\u89e3\u51b3\u95ee\u9898\uff1f\u82e5\u662f\u80fd\u7ed9\u4f60\u5e26\u6765\u5b66\u4e60\u4e0a\u7684\u5e2e\u52a9\uff0c\u8bf7\u5927\u5bb6\u591a\u591a\u652f\u6301\u7c73\u4e91\uff01\u66f4\u591a\u5173\u4e8e\u6587\u7ae0\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u4e5f\u53ef\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u3002<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1aphp \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   Win10\u7f51\u7edc\u51fa\u73b0\u611f\u53f9\u53f7\u600e\u4e48\u89e3\u51b3 Win10\u7f51\u7edc\u611f\u53f9\u53f7\u4fee\u590d\u65b9\u6cd5\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f \u6536\u85cf \u5728IT\u884c\u4e1a\u8fd9\u4e2a\u53d1\u5c55\u66f4\u65b0\u901f\u5ea6\u5f88\u5feb\u7684\u884c\u4e1a\uff0c\u53ea\u6709\u4e0d\u505c\u6b62\u7684\u5b66\u4e60\uff0c\u624d\u4e0d\u4f1a\u88ab\u884c\u4e1a\u6240\u6dd8\u6c70\u3002\u5982\u679c\u4f60\u662f\u6587\u7ae0\u5b66\u4e60\u8005\uff0c\u90a3\u4e48\u672c\u6587\u300a\u5982\u4f55\u5728 CSS \u5a92\u4f53\u67e5\u8be2\u4e2d\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1f\u300b\u5c31\u5f88\u9002\u5408\u4f60\uff01\u672c\u7bc7\u5185\u5bb9\u4e3b\u8981\u5305\u62ec##content_title##\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5b9e\u6218\u5f00\u53d1\uff01 CSS \u5a92\u4f53\u67e5\u8be2\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c \u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u9700\u8981\u6839\u636e\u4e0d\u540c\u8bbe\u5907\u5c4f\u5e55\u5c3a\u5bf8\u6765\u4fee\u6539\u6837\u5f0f\u7684\u9700\u6c42\u3002\u5176\u4e2d\uff0c\u79fb\u9664\u80cc\u666f\u56fe\u6548\u679c\u662f\u4e00\u4e2a\u5e38\u89c1\u95ee\u9898\u3002 \u4ee5\u4e0b HTML \u548c CSS \u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u5728 768px \u4ee5\u4e0b\u5c4f\u5e55\u53bb\u9664\u80cc\u666f\u56fe\u6548\u679c\uff1a &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&#8221;utf-8&#8243;&gt; &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1&#8243;&gt; &lt;meta http-equiv=&#8221;x-ua-compatible&#8221; content=&#8221;ie=edge&#8221;&gt; &lt;title&gt;&lt;\/title&gt; &lt;\/head&gt; &lt;body&gt; &lt;style type=&#8221;text\/css&#8221;&gt; #test { background-image: url(\u65e0\u6807\u9898.png); background-repeat: no-repeat; width: 100%; height: 500px; } @media (max-width: 768px) { #test { background-image: none; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53164","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53164"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53164\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}