{"id":2940,"date":"2018-07-31T17:02:01","date_gmt":"2018-07-31T09:02:01","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2940"},"modified":"2018-07-31T17:02:01","modified_gmt":"2018-07-31T09:02:01","slug":"css-%e7%9a%84%e7%a9%ba%e6%a0%bc%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2940","title":{"rendered":"CSS \u7684\u7a7a\u683c\u5904\u7406"},"content":{"rendered":"<p>\n\tHTML \u4ee3\u7801\u7684\u7a7a\u683c\u901a\u5e38\u4f1a\u88ab\u6d4f\u89c8\u5668\u5ffd\u7565\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073106.jpg\" title=\"\" \/>\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;p&gt;\u25e1\u25e1hello\u25e1\u25e1world\u25e1\u25e1&lt;\/p&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u662f\u4e00\u884c HTML \u4ee3\u7801\uff0c\u6587\u5b57\u7684\u524d\u90e8\u3001\u5185\u90e8\u548c\u540e\u90e8\u5404\u6709\u4e24\u4e2a\u7a7a\u683c\u3002\u4e3a\u4e86\u4fbf\u4e8e\u8bc6\u522b\uff0c\u8fd9\u91cc\u4f7f\u7528\u534a\u5706\u5f62\u7b26\u53f7<code>\u25e1<\/code>\u8868\u793a\u7a7a\u683c\u3002\n<\/p>\n<p>\n\t\u6d4f\u89c8\u5668\u7684\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nhello world\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u53ef\u4ee5\u770b\u5230\uff0c\u6587\u5b57\u7684\u524d\u90e8\u548c\u540e\u90e8\u7684\u7a7a\u683c\u90fd\u4f1a\u5ffd\u7565\uff0c\u5185\u90e8\u7684\u8fde\u7eed\u7a7a\u683c\u53ea\u4f1a\u7b97\u4f5c\u4e00\u4e2a\u3002\u8fd9\u5c31\u662f\u6d4f\u89c8\u5668\u5904\u7406\u7a7a\u683c\u7684\u57fa\u672c\u89c4\u5219\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u5e0c\u671b\u7a7a\u683c\u539f\u6837\u8f93\u51fa\uff0c\u53ef\u4ee5\u4f7f\u7528<code>&lt;pre&gt;<\/code>\u6807\u7b7e\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;pre&gt;\u25e1\u25e1hello\u25e1\u25e1world\u25e1\u25e1&lt;\/pre&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\uff0c\u6539\u7528 HTML \u5b9e\u4f53<code>&amp;nbsp;<\/code>\u8868\u793a\u7a7a\u683c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;p&gt;&amp;nbsp;&amp;nbsp;hello&amp;nbsp;&amp;nbsp;world&amp;nbsp;&amp;nbsp;&lt;\/p&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<h2>\n\t\u7a7a\u683c\u5b57\u7b26<br \/>\n<\/h2>\n<p>\n\tHTML \u5904\u7406\u7a7a\u683c\u7684\u89c4\u5219\uff0c\u9002\u7528\u4e8e\u591a\u79cd\u5b57\u7b26\u3002\u9664\u4e86\u666e\u901a\u7684\u7a7a\u683c\u952e\uff0c\u8fd8\u5305\u62ec\u5236\u8868\u7b26\uff08<code>\\t<\/code>\uff09\u548c\u6362\u884c\u7b26\uff08<code>\\r<\/code>\u548c<code>\\n<\/code>\uff09\u3002\n<\/p>\n<p>\n\t\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u628a\u8fd9\u4e9b\u7b26\u53f7\u8f6c\u6210\u666e\u901a\u7684\u7a7a\u683c\u952e\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;p&gt;hello\r\nworld&lt;\/p&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u6587\u672c\u5185\u90e8\u5305\u542b\u4e86\u4e00\u4e2a\u6362\u884c\u7b26\uff0c\u6d4f\u89c8\u5668\u89c6\u540c\u4e3a\u7a7a\u683c\uff0c\u8f93\u51fa\u7ed3\u679c\u5982\u4e0b\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\nhello world\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u6240\u4ee5\uff0c\u6587\u672c\u5185\u90e8\u7684\u6362\u884c\u662f\u65e0\u6548\u7684\uff08\u9664\u975e\u6587\u672c\u653e\u5728<code>&lt;pre&gt;<\/code>\u6807\u7b7e\u5185\uff09\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;p&gt;hello&lt;br&gt;world&lt;\/p&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4f7f\u7528<code>&lt;br&gt;<\/code>\u6807\u7b7e\u663e\u5f0f\u8868\u793a\u6362\u884c\u3002\n<\/p>\n<h2>\n\tCSS \u7684 white-space \u5c5e\u6027<br \/>\n<\/h2>\n<p>\n\tHTML \u8bed\u8a00\u7684\u7a7a\u683c\u5904\u7406\uff0c\u57fa\u672c\u4e0a\u5c31\u662f\u76f4\u63a5\u8fc7\u6ee4\u3002\u8fd9\u6837\u7684\u5904\u7406\u8fc7\u4e8e\u7c97\u7cd9\uff0c\u5b8c\u5168\u5ffd\u89c6\u4e86\u539f\u59cb\u6587\u672c\u5185\u90e8\u7684\u7a7a\u683c\u53ef\u80fd\u662f\u6709\u610f\u4e49\u7684\u3002\n<\/p>\n<p>\n\tCSS \u63d0\u4f9b\u4e86\u4e00\u4e2a<code>white-space<\/code>\u5c5e\u6027\uff0c\u53ef\u4ee5\u63d0\u4f9b\u66f4\u7cbe\u786e\u4e00\u70b9\u7684\u7a7a\u683c\u5904\u7406\u65b9\u5f0f\u3002\u8be5\u5c5e\u6027\u5171\u6709\u516d\u4e2a\u503c\uff0c\u9664\u4e86\u4e00\u4e2a\u901a\u7528\u7684<code>inherit<\/code>\uff08\u7ee7\u627f\u7236\u5143\u7d20\uff09\uff0c\u4e0b\u9762\u4f9d\u6b21\u4ecb\u7ecd\u5269\u4e0b\u7684\u4e94\u4e2a\u503c\u3002\n<\/p>\n<h3>\n\twhite-space: normal<br \/>\n<\/h3>\n<p>\n\t<code>white-space<\/code>\u5c5e\u6027\u7684\u9ed8\u8ba4\u503c\u4e3a<code>normal<\/code>\uff0c\u8868\u793a\u6d4f\u89c8\u5668\u4ee5\u6b63\u5e38\u65b9\u5f0f\u5904\u7406\u7a7a\u683c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\n&lt;p&gt;\u25e1\u25e1hellohellohello\u25e1hello\r\nworld\r\n&lt;\/p&gt;\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u6587\u672c\u524d\u90e8\u6709\u4e24\u4e2a\u7a7a\u683c\uff0c\u5185\u90e8\u6709\u4e00\u4e2a\u957f\u5355\u8bcd\u548c\u4e00\u4e2a\u6362\u884c\u7b26\u3002\n<\/p>\n<p>\n\t\u7136\u540e\uff0c\u5bb9\u5668<code>&lt;p&gt;<\/code>\u6307\u5b9a\u4e00\u4e2a\u6bd4\u8f83\u5c0f\u7684\u5bbd\u5ea6\u3002\u4e3a\u4e86\u4fbf\u4e8e\u8bc6\u522b\uff0c\u80cc\u666f\u8272\u8bbe\u4e3a\u7ea2\u8272\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\np {\r\n  width: 100px;\r\n  background: red;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073101.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u53ef\u4ee5\u770b\u5230\uff0c\u6587\u9996\u7684\u7a7a\u683c\u88ab\u5ffd\u7565\u3002\u7531\u4e8e\u5bb9\u5668\u592a\u7a84\uff0c\u7b2c\u4e00\u4e2a\u5355\u8bcd\u6ea2\u51fa\u5bb9\u5668\uff0c\u7136\u540e\u5728\u540e\u9762\u4e00\u4e2a\u7a7a\u683c\u5904\u6362\u884c\u3002\u6587\u672c\u5185\u90e8\u7684\u6362\u884c\u7b26\u81ea\u52a8\u8f6c\u6210\u4e86\u7a7a\u683c\u3002\n<\/p>\n<h3>\n\twhite-space: nowrap<br \/>\n<\/h3>\n<p>\n\t<code>white-space<\/code>\u5c5e\u6027\u4e3a<code>nowrap<\/code>\u65f6\uff0c\u4e0d\u4f1a\u56e0\u4e3a\u8d85\u51fa\u5bb9\u5668\u5bbd\u5ea6\u800c\u53d1\u751f\u6362\u884c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\np {\r\n  white-space: nowrap;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073102.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u6240\u6709\u6587\u672c\u663e\u793a\u4e3a\u4e00\u884c\uff0c\u4e0d\u4f1a\u6362\u884c\u3002\n<\/p>\n<h3>\n\twhite-space: pre<br \/>\n<\/h3>\n<p>\n\t<code>white-space<\/code>\u5c5e\u6027\u4e3a<code>pre<\/code>\u65f6\uff0c\u5c31\u6309\u7167<code>&lt;pre&gt;<\/code>\u6807\u7b7e\u7684\u65b9\u5f0f\u5904\u7406\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\np {\r\n  white-space: pre;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073103.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u4e0a\u9762\u7ed3\u679c\u4e0e\u539f\u59cb\u6587\u672c\u5b8c\u5168\u4e00\u81f4\uff0c\u6240\u6709\u7a7a\u683c\u548c\u6362\u884c\u7b26\u90fd\u4fdd\u7559\u4e86\u3002\n<\/p>\n<h3>\n\twhite-space: pre-wrap<br \/>\n<\/h3>\n<p>\n\t<code>white-space<\/code>\u5c5e\u6027\u4e3a<code>pre-wrap<\/code>\u65f6\uff0c\u57fa\u672c\u8fd8\u662f\u6309\u7167<code>&lt;pre&gt;<\/code>\u6807\u7b7e\u7684\u65b9\u5f0f\u5904\u7406\uff0c\u552f\u4e00\u533a\u522b\u662f\u8d85\u51fa\u5bb9\u5668\u5bbd\u5ea6\u65f6\uff0c\u4f1a\u53d1\u751f\u6362\u884c\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\np {\r\n  white-space: pre-wrap;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073104.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u6587\u9996\u7684\u7a7a\u683c\u3001\u5185\u90e8\u7684\u7a7a\u683c\u548c\u6362\u884c\u7b26\u90fd\u4fdd\u7559\u4e86\uff0c\u8d85\u51fa\u5bb9\u5668\u7684\u5730\u65b9\u53d1\u751f\u4e86\u6298\u884c\u3002\n<\/p>\n<h3>\n\twhite-space: pre-line<br \/>\n<\/h3>\n<p>\n\t<code>white-space<\/code>\u5c5e\u6027\u4e3a<code>pre-line<\/code>\u65f6\uff0c\u610f\u4e3a\u4fdd\u7559\u6362\u884c\u7b26\u3002\u9664\u4e86\u6362\u884c\u7b26\u4f1a\u539f\u6837\u8f93\u51fa\uff0c\u5176\u4ed6\u90fd\u4e0e<code>white-space:normal<\/code>\u89c4\u5219\u4e00\u81f4\u3002\n<\/p>\n<blockquote>\n<pre>\r\n<code>\r\np {\r\n  white-space: pre-line;\r\n}\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\n\t\u663e\u793a\u6548\u679c\u5982\u4e0b\u56fe\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wangbase.com\/blogimg\/asset\/201807\/bg2018073105.png\" title=\"\" \/>\n<\/p>\n<p>\n\t\u9664\u4e86\u6587\u672c\u5185\u90e8\u7684\u6362\u884c\u7b26\u6ca1\u6709\u8f6c\u6210\u7a7a\u683c\uff0c\u5176\u4ed6\u90fd\u4e0e<code>normal<\/code>\u7684\u5904\u7406\u89c4\u5219\u4e00\u81f4\u3002\u8fd9\u5bf9\u4e8e\u8bd7\u6b4c\u7c7b\u578b\u7684\u6587\u672c\u5f88\u6709\u7528\u3002\n<\/p>\n<h2>\n\t\u53c2\u8003\u94fe\u63a5<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/medium.com\/@patrickbrosset\/when-does-white-space-matter-in-html-b90e8a7cdd33\" target=\"_blank\">When does white space matter in HTML?<\/a>\uff0cby Patrick Brosset\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/css-tricks.com\/almanac\/properties\/w\/whitespace\/\" target=\"_blank\">white-space<\/a>\uff0cby Sara Cope\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2940\">CSS \u7684\u7a7a\u683c\u5904\u7406<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>HTML \u4ee3\u7801\u7684\u7a7a\u683c\u901a\u5e38\u4f1a\u88ab\u6d4f\u89c8\u5668\u5ffd\u7565\u3002 &lt;p&gt;\u25e1\u25e1hello\u25e1\u25e1world\u25e1\u25e1&lt;\/p&#038;gt [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[158,814,333,1505,1053],"class_list":["post-2940","post","type-post","status-publish","format-standard","hentry","category-html5","tag-animate-css","tag-css3","tag-emoji-css"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2940"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2940\/revisions"}],"predecessor-version":[{"id":2941,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2940\/revisions\/2941"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}