{"id":1830,"date":"2025-02-21T22:54:03","date_gmt":"2025-02-21T14:54:03","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1830"},"modified":"2025-02-21T22:54:03","modified_gmt":"2025-02-21T14:54:03","slug":"css3-%e5%ad%97%e4%bd%93","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/21\/css3-%e5%ad%97%e4%bd%93\/","title":{"rendered":"CSS3\u00a0\u5b57\u4f53"},"content":{"rendered":"\n<p>CSS3 \u5b57\u4f53\u76f8\u5173\u7684\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5b57\u4f53\u7684\u5b9a\u4e49\u3001\u52a0\u8f7d\u3001\u6837\u5f0f\u3001\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7 CSS \u63a7\u5236\u5b57\u4f53\u7684\u663e\u793a\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u7684 CSS3 \u5b57\u4f53\u76f8\u5173\u5c5e\u6027\u548c\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>font-family<\/strong><\/h3>\n\n\n\n<p>\u5b9a\u4e49\u5143\u7d20\u7684\u5b57\u4f53\u7cfb\u5217\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u4f53\uff0c\u5e76\u6309\u987a\u5e8f\u4ece\u5de6\u5230\u53f3\u67e5\u627e\u53ef\u7528\u5b57\u4f53\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>body {\n  font-family: \"Arial\", \"Helvetica\", sans-serif;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u9996\u5148\u4f1a\u5c1d\u8bd5\u4f7f\u7528 <code>Arial<\/code> \u5b57\u4f53\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u4f7f\u7528 <code>Helvetica<\/code>\uff0c\u5982\u679c\u8fd9\u4e9b\u5b57\u4f53\u90fd\u4e0d\u53ef\u7528\uff0c\u5219\u4f7f\u7528\u9ed8\u8ba4\u7684\u65e0\u886c\u7ebf\u5b57\u4f53 <code>sans-serif<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>font-size<\/strong><\/h3>\n\n\n\n<p>\u5b9a\u4e49\u5b57\u4f53\u7684\u5927\u5c0f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>h1 {\n  font-size: 36px;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u8bbe\u7f6e\u4e86 <code>h1<\/code> \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u4e3a 36 \u50cf\u7d20\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>font-weight<\/strong><\/h3>\n\n\n\n<p>\u63a7\u5236\u5b57\u4f53\u7684\u7c97\u7ec6\u3002\u5e38\u7528\u7684\u503c\u6709 <code>normal<\/code>\u3001<code>bold<\/code>\uff0c\u6216\u8005\u5177\u4f53\u7684\u6570\u503c\uff08100\u5230900\uff09\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>p {\n  font-weight: bold;\n}<\/code><\/pre>\n\n\n\n<p>\u8be5\u4f8b\u5b50\u5c06\u6bb5\u843d\u5b57\u4f53\u8bbe\u7f6e\u4e3a\u7c97\u4f53\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>font-style<\/strong><\/h3>\n\n\n\n<p>\u5b9a\u4e49\u5b57\u4f53\u7684\u6837\u5f0f\uff0c\u5982\u659c\u4f53\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>em {\n  font-style: italic;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u4f7f\u5f97 <code>&lt;em&gt;<\/code> \u5143\u7d20\u7684\u6587\u5b57\u53d8\u4e3a\u659c\u4f53\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>@font-face<\/strong><\/h3>\n\n\n\n<p>\u901a\u8fc7 <code>@font-face<\/code> \u89c4\u5219\uff0c\u60a8\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7f51\u9875\u7684\u5b57\u4f53\uff0c\u751a\u81f3\u662f\u5f15\u5165\u7f51\u7edc\u5b57\u4f53\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@font-face {\n  font-family: \"MyCustomFont\";\n  src: url(\"my-custom-font.woff2\") format(\"woff2\"),\n       url(\"my-custom-font.woff\") format(\"woff\");\n}\n\nbody {\n  font-family: \"MyCustomFont\", Arial, sans-serif;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u901a\u8fc7 <code>@font-face<\/code> \u5f15\u5165\u4e86\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b57\u4f53 <code>MyCustomFont<\/code>\uff0c\u5e76\u4e3a\u9875\u9762\u6307\u5b9a\u4e86\u8fd9\u4e2a\u5b57\u4f53\u3002\u5982\u679c\u8be5\u5b57\u4f53\u4e0d\u53ef\u7528\uff0c\u5219\u4f7f\u7528 <code>Arial<\/code> \u548c\u9ed8\u8ba4\u7684\u65e0\u886c\u7ebf\u5b57\u4f53\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>line-height<\/strong><\/h3>\n\n\n\n<p>\u63a7\u5236\u884c\u9ad8\uff0c\u53ef\u4ee5\u8ba9\u6587\u5b57\u7684\u884c\u95f4\u8ddd\u66f4\u5408\u9002\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>p {\n  line-height: 1.6;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8ba9\u6bb5\u843d\u7684\u884c\u9ad8\u662f\u5b57\u4f53\u5927\u5c0f\u7684 1.6 \u500d\uff0c\u4f7f\u5f97\u6bb5\u843d\u95f4\u7684\u95f4\u8ddd\u66f4\u4e3a\u8212\u9002\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>text-transform<\/strong><\/h3>\n\n\n\n<p>\u63a7\u5236\u6587\u672c\u7684\u5927\u5c0f\u5199\u8f6c\u6362\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>h2 {\n  text-transform: uppercase;\n}<\/code><\/pre>\n\n\n\n<p>\u8be5\u6837\u5f0f\u4f1a\u628a\u6240\u6709 <code>h2<\/code> \u5143\u7d20\u4e2d\u7684\u6587\u672c\u8f6c\u6362\u4e3a\u5927\u5199\u5b57\u6bcd\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. <strong>letter-spacing<\/strong><\/h3>\n\n\n\n<p>\u8c03\u6574\u5b57\u7b26\u95f4\u8ddd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>h2 {\n  letter-spacing: 2px;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u4f8b\u5b50\u8bbe\u7f6e\u4e86 <code>h2<\/code> \u5143\u7d20\u7684\u5b57\u6bcd\u95f4\u8ddd\u4e3a 2 \u50cf\u7d20\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7efc\u5408\u5b9e\u4f8b<\/h3>\n\n\n\n<p>\u5047\u8bbe\u6211\u4eec\u60f3\u521b\u5efa\u4e00\u4e2a\u6709\u81ea\u5b9a\u4e49\u5b57\u4f53\u7684\u7f51\u9875\u6807\u9898\uff0c\u6837\u5f0f\u8981\u5305\u62ec\u5b57\u4f53\u3001\u5927\u5c0f\u3001\u884c\u9ad8\u7b49\uff1a<\/p>\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;CSS3 \u5b57\u4f53\u793a\u4f8b&lt;\/title&gt;\n  &lt;style&gt;\n    @font-face {\n      font-family: \"MyCustomFont\";\n      src: url(\"my-custom-font.woff2\") format(\"woff2\"),\n           url(\"my-custom-font.woff\") format(\"woff\");\n    }\n\n    h1 {\n      font-family: \"MyCustomFont\", Arial, sans-serif;\n      font-size: 48px;\n      font-weight: bold;\n      font-style: italic;\n      line-height: 1.4;\n      text-transform: capitalize;\n      letter-spacing: 1px;\n    }\n  &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;h1&gt;Welcome to the Font Styling Example&lt;\/h1&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u9875\u9762\u4f7f\u7528\u4e86 <code>@font-face<\/code> \u6765\u52a0\u8f7d\u81ea\u5b9a\u4e49\u5b57\u4f53\uff0c\u5e76\u4e14\u901a\u8fc7 CSS3 \u63a7\u5236\u4e86\u6807\u9898\u7684\u5b57\u4f53\u3001\u5927\u5c0f\u3001\u884c\u9ad8\u3001\u6587\u672c\u8f6c\u6362\u3001\u5b57\u6bcd\u95f4\u8ddd\u7b49\u5c5e\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSS3 \u5b57\u4f53\u76f8\u5173\u7684\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5b57\u4f53\u7684\u5b9a\u4e49\u3001\u52a0\u8f7d\u3001\u6837\u5f0f\u3001\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7 CSS \u63a7\u5236\u5b57\u4f53\u7684\u663e\u793a\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1830","post","type-post","status-publish","format-standard","hentry","category-css"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1830"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1830\/revisions"}],"predecessor-version":[{"id":1831,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1830\/revisions\/1831"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}