摘要:關鍵詞,實現和固定,中間多了滾動,少了撐滿和寬度根據內容撐起,當然你可以自己設置小二,上代碼來嘍布局關鍵的來啦關鍵,布局關鍵,三塊主題擺放。
關鍵詞:display: flex,flex: 1,? overflow-y: scroll;
實現:head 和footer 固定,中間body多了滾動,少了撐滿; head和footer寬度根據內容撐起,當然你可以自己設置........
小二,上代碼!
來嘍~~
// html布局 html body div div Page Not FoundPage Not FoundPage Not FoundPage Not FoundPage /div div div orry, but the page you were trying to view does not exist. /div div shhhhsss /div div shhhhsss /div div shhhhsss /div div shhhhsss /div div shhhhsss /div /div div Page Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not Found /div /div /body /html
關鍵的css來啦!
2 * { 3 line-height: 1.2; 4 margin: 0; 6 html, body { 7 font-family: sans-serif; 8 height: 100%; 9 width: 100%; 11 .container{ 12 display: flex; // 關鍵, flex布局 13 flex-direction: column; // 關鍵,三塊主題column擺放。 14 height: 100vh; // 關鍵,設置高度為可見高度的100%; 16 .head{ 17 width: 100%; 18 background: springgreen; 20 .body{ 21 flex: 1; // 關鍵, 填充剩余空間 22 width: 100%; 23 background: lightyellow; 24 overflow-y: scroll; // 關鍵, 超出部分滾動 26 .footer{ 27 width: 100%; 28 background: goldenrod; 29 }
?附上全部代碼,可以自己復制到瀏覽器中打開,看效果~
!doctype html html lang="en" head meta charset="utf-8" title Page Not Found /title meta name="viewport" content="width=device-width, initial-scale=1" style line-height: 1.2; margin: 0; html, body { color: #888; font-family: sans-serif; height: 100%; width: 100%; .container{ display: flex; height: 100vh; flex-direction: column; .head{ width: 100%; background: springgreen; .body { background: lightyellow; width: 100%; flex:1; color: black; overflow-y: scroll; .footer { background: goldenrod; width: 100%; .body div { height: 200px; width: 300px; background: greenyellow; margin: 20px; /style /head body div div Page Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not Found /div div div orry, but the page you were trying to view does not exist. /div div shhhhsss /div div shhhhsss /div div shhhhsss /div div shhhhsss /div div shhhhsss /div /div div Page Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not FoundPage Not Found /div /div /body /html
?
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/782.html
摘要:關鍵詞,實現和固定,中間多了滾動,少了撐滿和寬度根據內容撐起,當然你可以自己設置小二,上代碼來嘍布局關鍵的來啦關鍵,布局關鍵,三塊主題擺放。關鍵詞:display: flex,flex: 1,? overflow-y: scroll; 實現:head 和footer 固定,中間body多了滾動,少了撐滿; head和footer寬度根據內容撐起,當然你可以自己設置........ 小二,上代...
摘要:關鍵詞,實現和固定,中間多了滾動,少了撐滿和寬度根據內容撐起,當然你可以自己設置小二,上代碼來嘍布局關鍵的來啦關鍵,布局關鍵,三塊主題擺放。關鍵詞:display: flex,flex: 1,? overflow-y: scroll; 實現:head 和footer 固定,中間body多了滾動,少了撐滿; head和footer寬度根據內容撐起,當然你可以自己設置........ 小二,...
摘要:關鍵詞,實現和固定,中間多了滾動,少了撐滿和寬度根據內容撐起,當然你可以自己設置小二,上代碼來嘍布局關鍵的來啦關鍵,布局關鍵,三塊主題擺放。關鍵詞:display: flex,flex: 1,? overflow-y: scroll; 實現:head 和footer 固定,中間body多了滾動,少了撐滿; head和footer寬度根據內容撐起,當然你可以自己設置........ 小二,...
閱讀 1428·2021-11-22 15:24
閱讀 2519·2021-10-11 11:06
閱讀 2323·2021-10-09 09:45
閱讀 2525·2021-09-09 09:33
閱讀 634·2019-08-30 15:53
閱讀 1439·2019-08-30 12:48
閱讀 657·2019-08-29 13:47
閱讀 500·2019-08-26 18:27