{"id":6,"date":"2025-11-20T16:28:17","date_gmt":"2025-11-20T08:28:17","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=6"},"modified":"2025-11-20T16:28:17","modified_gmt":"2025-11-20T08:28:17","slug":"%e4%bd%bf%e7%94%a8html%e5%92%8ccss%e5%ae%9e%e7%8e%b0%e6%96%87%e5%ad%97%e9%95%82%e7%a9%ba%e6%95%88%e6%9e%9c%e7%9a%84%e4%bb%a3%e7%a0%81%e7%a4%ba%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/11\/20\/%e4%bd%bf%e7%94%a8html%e5%92%8ccss%e5%ae%9e%e7%8e%b0%e6%96%87%e5%ad%97%e9%95%82%e7%a9%ba%e6%95%88%e6%9e%9c%e7%9a%84%e4%bb%a3%e7%a0%81%e7%a4%ba%e4%be%8b\/","title":{"rendered":"\u4f7f\u7528HTML\u548cCSS\u5b9e\u73b0\u6587\u5b57\u9542\u7a7a\u6548\u679c\u7684\u4ee3\u7801\u793a\u4f8b"},"content":{"rendered":"\n<p>\u8981\u5b9e\u73b0\u6587\u5b57\u9542\u7a7a\u6548\u679c\uff0c\u53ef\u4ee5\u5229\u7528&nbsp;<code>background-clip<\/code>&nbsp;\u5c5e\u6027\u548c\u900f\u660e\u5ea6 (<code>opacity<\/code>) \u7684\u7ed3\u5408\uff0c\u6765\u5b9e\u73b0\u6587\u5b57\u5185\u90e8\u7684\u9542\u7a7a\u6548\u679c\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u57fa\u672c\u7684 HTML \u548c CSS \u4ee3\u7801\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528\u6587\u5b57\u9542\u7a7a\u6548\u679c\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTML:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;\u6587\u5b57\u9542\u7a7a\u6548\u679c&lt;\/title&gt;\n    &lt;link rel=\"stylesheet\" href=\"styles.css\"&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div class=\"hollow-text\"&gt;\n        \u9542\u7a7a\u6587\u5b57\u6548\u679c\n    &lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">CSS (styles.css):<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>body {\n    margin: 0;\n    padding: 0;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    height: 100vh;\n    background-color: #f0f0f0;\n}\n\n.hollow-text {\n    font-size: 80px;\n    font-weight: bold;\n    color: transparent; \/* \u6587\u5b57\u989c\u8272\u900f\u660e *\/\n    background: url('https:\/\/www.example.com\/path\/to\/your\/image.jpg') no-repeat center center; \/* \u80cc\u666f\u56fe\u50cf *\/\n    background-size: cover; \/* \u80cc\u666f\u56fe\u50cf\u8986\u76d6 *\/\n    -webkit-background-clip: text; \/* \u652f\u6301 Webkit \u6d4f\u89c8\u5668\uff08\u5982 Chrome, Safari\uff09 *\/\n    background-clip: text; \/* \u652f\u6301\u5176\u4ed6\u6d4f\u89c8\u5668 *\/\n    text-align: center;\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u89e3\u91ca:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>color: transparent;<\/code>\u00a0\u4f7f\u6587\u5b57\u672c\u8eab\u53d8\u4e3a\u900f\u660e\u3002<\/li>\n\n\n\n<li><code>background: url('image.jpg') no-repeat center center;<\/code>\u00a0\u8bbe\u7f6e\u80cc\u666f\u56fe\u7247\u3002\u4f60\u53ef\u4ee5\u66ff\u6362\u6210\u4efb\u4f55\u4f60\u559c\u6b22\u7684\u56fe\u7247 URL\u3002<\/li>\n\n\n\n<li><code>background-size: cover;<\/code>\u00a0\u786e\u4fdd\u80cc\u666f\u56fe\u7247\u8986\u76d6\u6574\u4e2a\u5bb9\u5668\u3002<\/li>\n\n\n\n<li><code>background-clip: text;<\/code>\u00a0\u548c\u00a0<code>-webkit-background-clip: text;<\/code>\u00a0\u5b9e\u73b0\u4e86\u6587\u5b57\u586b\u5145\u80cc\u666f\u56fe\u50cf\u7684\u6548\u679c\uff0c\u4ece\u800c\u8fbe\u5230\u4e86\u6587\u5b57\u9542\u7a7a\u7684\u6548\u679c\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u901a\u8fc7\u8fd9\u79cd\u65b9\u6cd5\uff0c\u6587\u5b57\u5185\u90e8\u4f1a\u663e\u793a\u80cc\u666f\u56fe\u50cf\uff0c\u770b\u8d77\u6765\u50cf\u662f\u9542\u7a7a\u7684\u6548\u679c\u3002<\/p>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong>&nbsp;\u76ee\u524d\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e3b\u8981\u9002\u7528\u4e8e\u652f\u6301&nbsp;<code>background-clip: text;<\/code>&nbsp;\u7684\u6d4f\u89c8\u5668\uff08\u5982 Chrome\u3001Safari \u548c Edge\uff09\u3002\u67d0\u4e9b\u8001\u7248\u672c\u7684\u6d4f\u89c8\u5668\u53ef\u80fd\u4e0d\u652f\u6301\u8be5\u5c5e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u5b9e\u73b0\u6587\u5b57\u9542\u7a7a\u6548\u679c\uff0c\u53ef\u4ee5\u5229\u7528&nbsp;background-clip&#038;nbsp&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/11\/20\/%e4%bd%bf%e7%94%a8html%e5%92%8ccss%e5%ae%9e%e7%8e%b0%e6%96%87%e5%ad%97%e9%95%82%e7%a9%ba%e6%95%88%e6%9e%9c%e7%9a%84%e4%bb%a3%e7%a0%81%e7%a4%ba%e4%be%8b\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-html-xhtml"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":7,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions\/7"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}