{"id":8452,"date":"2024-06-08T12:01:01","date_gmt":"2024-06-08T04:01:01","guid":{"rendered":""},"modified":"2024-06-08T12:01:01","modified_gmt":"2024-06-08T04:01:01","slug":"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8452.html","title":{"rendered":"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f"},"content":{"rendered":"

\n <\/path> \n<\/svg> <\/p>\n

\u60f3\u8981\u4ee4body\u91cc\u4e00\u4e2a\u5757\u5143\u7d20\uff08div\uff09\u5360\u5168\u5c4f\uff0c\u76f8\u4fe1\u5f88\u591a\u4eba\uff08\u5305\u62ec\u6211\uff09\u90fd\u4f1a\u76f4\u63a5\u628abody\u8bbe\u7f6e\u5bbd\u9ad8100%\uff0c\u4f46\u5b9e\u9645\u5374\u662f\uff0c\u884c\u4e0d\u901a\uff1a
\"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f
\u539f\u56e0\uff1a<\/strong>\u56e0\u4e3abody\u8ddfdiv\u4e00\u6837\u662f\u5757\u5143\u7d20\uff0c\u76f4\u63a5\u8d4b\u503c\u7ed9\u5757\u5143\u7d20height:100%\uff0c\u76f8\u5f53\u4e8e\u5c31\u662f\u9ed8\u8ba4\u503c\u7684\u72ec\u5360\u4e00\u884c\u3002\u6240\u4ee5\u8fd9\u91cc\u5199body{ width:100%; height:100%;}<\/code>\uff0c\u5176\u5b9e\u662f\u6beb\u65e0\u4f5c\u7528\u7684\u3002\u300acss\u6743\u5a01\u6307\u5357\u300b\u6307\u51fa\uff0c\u5982\u679c\u6ca1\u6709\u663e\u793a\u58f0\u660e\u5305\u542b\u5757\u7684height\uff0c\u767e\u5206\u6570\u9ad8\u5ea6\u4f1a\u91cd\u7f6e\u4e3aauto\uff0c\u6240\u4ee5\u4e0a\u9762div1height\u8bbe\u7f6e\u4e3a\u4efb\u4f55\u503c\u90fd\u8ddf\u8bbe\u7f6e\u6ca1\u8bbe\u7f6e\u4e00\u6837\u3002\u5305\u542b\u5757\u4e0ediv1\u9ad8\u5ea6\u5b8c\u5168\u76f8\u540c\u3002<\/strong><\/p>\n

\u4f46\u662f\u53c8\u4e0d\u5e0c\u671b\u7ed9body\u8bbe\u7f6e\u56fa\u5b9a\u7684\u5927\u503c\u5bbd\u9ad8\uff0c\u600e\u4e48\u529e\uff1f<\/p>\n


\n

<\/p>\n

\u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a\u7ed9div\u8bbe\u7f6e{position: absolute; top: 0px; bottom: 0px;}<\/code><\/h3>\n

\"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f<\/p>\n

<!DOCTYPE html><\/span> <<\/span>html<\/span>><\/span><\/span> <<\/span>head<\/span>><\/span><\/span> <<\/span>meta<\/span> charset<\/span>=<\/span>\"<\/span>utf-8\"<\/span><\/span>><\/span><\/span> <<\/span>title<\/span>><\/span><\/span>div\u5360\u636e\u5168\u5c4f<\/<\/span>title<\/span>><\/span><\/span> <<\/span>style<\/span> class<\/span>=<\/span>\"<\/span>text\/css\"<\/span><\/span>><\/span><\/span> body<\/span>{ \n    <\/span> padding<\/span>:<\/span> 0px;<\/span> margin<\/span>:<\/span> 0px;<\/span> }<\/span> .box<\/span>{ \n    <\/span> background-color<\/span>:<\/span> yellow;<\/span> width<\/span>:<\/span> 100%;<\/span> height<\/span>:<\/span> 100%;<\/span> position<\/span>:<\/span> absolute;<\/span> top<\/span>:<\/span> 0px;<\/span> bottom<\/span>:<\/span> 0px;<\/span> }<\/span> <\/span><\/<\/span>style<\/span>><\/span><\/span> <\/<\/span>head<\/span>><\/span><\/span> <<\/span>body<\/span>><\/span><\/span> <<\/span>div<\/span> class<\/span>=<\/span>\"<\/span>box\"<\/span><\/span>><\/span><\/span><\/<\/span>div<\/span>><\/span><\/span> <\/<\/span>body<\/span>><\/span><\/span> <\/<\/span>html<\/span>><\/span><\/span> <\/code><\/pre>\n

<\/p>\n


\n

<\/p>\n

\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff1a\u52a0\u4e0ahtml,body{ width:100%; height:100%; }<\/code><\/h3>\n

\"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f<\/p>\n

<!DOCTYPE html><\/span> <<\/span>html<\/span>><\/span><\/span> <<\/span>head<\/span>><\/span><\/span> <<\/span>meta<\/span> charset<\/span>=<\/span>\"<\/span>utf-8\"<\/span><\/span>><\/span><\/span> <<\/span>title<\/span>><\/span><\/span>div\u5360\u636e\u5168\u5c4f<\/<\/span>title<\/span>><\/span><\/span> <<\/span>style<\/span> class<\/span>=<\/span>\"<\/span>text\/css\"<\/span><\/span>><\/span><\/span> body<\/span>{ \n    <\/span> padding<\/span>:<\/span> 0px;<\/span> margin<\/span>:<\/span> 0px;<\/span> }<\/span> html,body<\/span>{ \n    <\/span> width<\/span>:<\/span> 100%;<\/span> height<\/span>:<\/span> 100%;<\/span> }<\/span> .box<\/span>{ \n    <\/span> background-color<\/span>:<\/span> yellow;<\/span> width<\/span>:<\/span> 100%;<\/span> height<\/span>:<\/span> 100%;<\/span> }<\/span> <\/span><\/<\/span>style<\/span>><\/span><\/span> <\/<\/span>head<\/span>><\/span><\/span> <<\/span>body<\/span>><\/span><\/span> <<\/span>div<\/span> class<\/span>=<\/span>\"<\/span>box\"<\/span><\/span>><\/span><\/span><\/<\/span>div<\/span>><\/span><\/span> <\/<\/span>body<\/span>><\/span><\/span> <\/<\/span>html<\/span>><\/span><\/span> <\/code><\/pre>\n

<\/p>\n


\n

<\/p>\n

\u7b2c\u4e09\u79cd\uff0c\u4e5f\u662f\u6211\u6700\u559c\u6b22\u7528\u7684\uff1a\u7ed9\u8be5\u5143\u7d20\u8bbe\u7f6e{min-width: 100%; min-height: 100%; position: absolute;}<\/code><\/h3>\n

\u3010\u4f18\u70b9\uff1a\u2460\u7b80\u6d01\uff0c\u2461\u7f29\u5c0f\u6d4f\u89c8\u5668\uff0c\u62c9\u52a8\u6eda\u52a8\u6761\u4e5f\u8fd8\u662f\u6ee1\u5c4f\u80cc\u666f\u3011 <\/p>\n

\"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f<\/p>\n

<!DOCTYPE html><\/span> <<\/span>html<\/span>><\/span><\/span> <<\/span>head<\/span>><\/span><\/span> <<\/span>meta<\/span> charset<\/span>=<\/span>\"<\/span>utf-8\"<\/span><\/span>><\/span><\/span> <<\/span>title<\/span>><\/span><\/span>div\u5360\u636e\u5168\u5c4f<\/<\/span>title<\/span>><\/span><\/span> <<\/span>style<\/span> type<\/span>=<\/span>\"<\/span>text\/css\"<\/span><\/span>><\/span><\/span> body<\/span> { \n    <\/span> padding<\/span>:<\/span> 0;<\/span> margin<\/span>:<\/span> 0;<\/span> }<\/span> .bg<\/span> { \n    <\/span> min-width<\/span>:<\/span> 100%;<\/span> min-height<\/span>:<\/span> 100%;<\/span> position<\/span>:<\/span> absolute;<\/span> background<\/span>:<\/span> yellow;<\/span> }<\/span> <\/span><\/<\/span>style<\/span>><\/span><\/span> <\/<\/span>head<\/span>><\/span><\/span> <<\/span>body<\/span>><\/span><\/span> <<\/span>div<\/span> class<\/span>=<\/span>\"<\/span>bg\"<\/span><\/span>><\/span><\/span><\/<\/span>div<\/span>><\/span><\/span> <\/<\/span>body<\/span>><\/span><\/span> <\/<\/span>html<\/span>><\/span><\/span> <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"div\u5728body\u5c45\u4e2d_\u600e\u4e48\u8ba9div\u968f\u9875\u9762\u7f29\u5c0f\u800c\u7f29\u5c0f\u60f3\u8981\u4ee4body\u91cc\u4e00\u4e2a\u5757\u5143\u7d20\uff08div\uff09\u5360\u5168\u5c4f\uff0c\u76f8\u4fe1\u5f88\u591a\u4eba\uff08\u5305\u62ec\u6211\uff09\u90fd\u4f1a\u76f4\u63a5\u628abody\u8bbe\u7f6e\u5bbd...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8452"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8452"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8452\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}