
{"id":1578,"date":"2020-07-27T11:22:07","date_gmt":"2020-07-27T03:22:07","guid":{"rendered":"http:\/\/admin.evshou.com\/?p=1578"},"modified":"2020-08-07T16:10:51","modified_gmt":"2020-08-07T08:10:51","slug":"web%e5%89%8d%e7%ab%af%ef%bc%9agrid%e7%bd%91%e6%a0%bc%e5%b8%83%e5%b1%80","status":"publish","type":"post","link":"https:\/\/www.9713job.com\/?p=1578","title":{"rendered":"web\u524d\u7aef\uff1agrid\u7f51\u683c\u5e03\u5c40"},"content":{"rendered":"<h3>grid\u7f51\u683c\u5e03\u5c40<\/h3>\n<p>grid\u7f51\u683c\u5e03\u5c40\u662f\u4e00\u4e2a\u4e8c\u7ef4\u7684\u5e03\u5c40\u65b9\u6cd5\uff0c\u7eb5\u6a2a\u4e24\u4e2a\u65b9\u5411\u603b\u662f\u540c\u65f6\u5b58\u5728<\/p>\n<p>\u4f5c\u7528\u5728grid\u5bb9\u5668\u4e0a<br \/>\ngrid-template-columns<br \/>\ngrid-template-rows<br \/>\ngrid-template-columns: 1fr 1fr 1fr\/100px auto 25%\/repeat(3,1fr)<br \/>\ngrid-template-rows :1fr 1fr 1fr\/100px 100px 200px 100px\/repeat(3,1fr)<\/p>\n<p>\u5bf9\u7f51\u683c\u8fdb\u884c\u6a2a\u7eb5\u5212\u5206\uff0c\u5f62\u6210\u4e8c\u7ef4\u5e03\u5c40\u3002\u5355\u4f4d\u53ef\u4ee5\u662f\u50cf\u7d20\uff0c\u767e\u5206\u6bd4\uff0c\u81ea\u9002\u5e94\u4ee5\u53cafr\u5355\u4f4d\uff08\u7f51\u683c\u5269\u4f59\u7a7a\u95f4\u6bd4\u4f8b\u5355\u4f4d\uff09\u3002<br \/>\n\u6709\u65f6\u5019\uff0c\u6211\u4eec\u7f51\u683c\u7684\u5212\u5206\u662f\u5f88\u89c4\u5f8b\u7684\uff0c\u5982\u679c\u9700\u8981\u6dfb\u52a0\u591a\u4e2a\u6a2a\u7eb5\u7f51\u683c\u65f6\uff0c\u53ef\u4ee5\u5229\u7528repeat()\u8bed\u6cd5\u8fdb\u884c\u7b80\u5316\u64cd\u4f5c\u3002<!--more--><\/p>\n<hr \/>\n<p>grid-template-areas<br \/>\ngrid-area<br \/>\ngrid-template<\/p>\n<p>area\u662f\u533a\u57df\u7684\u610f\u601d<br \/>\ngrid-template-areas\u5c31\u662f\u7ed9\u6211\u4eec\u7684\u7f51\u683c\u5212\u5206\u533a\u57df\u7684\u3002\u6b64\u65f6grid\u5b50\u9879\u53ea\u8981\u4f7f\u7528grid-area\u5c5e\u6027\u6307\u5b9a\u5176\u96b6\u5c5e\u4e8e\u90a3\u4e2a\u533a\u3002<br \/>\ngrid-template\u662fgrid-template-rows,grid-template-columns\u548cgrid-template-areas\u5c5e\u6027\u7684\u7f29\u5199\u3002<br \/>\n\u6848\u4f8b\uff1a<br \/>\n.box2{<br \/>\ngrid-template-columns: repeat(3,1fr)<br \/>\ngrid-template-rows : repeat(3,1fr)<br \/>\ngrid-template-areas:<br \/>\n&#8220;a1 a1 a1&#8221;<br \/>\n&#8220;a2 a2 a3&#8221;<br \/>\n&#8220;a2 a2 a3&#8221;;<br \/>\n}\/\/\u540d\u5b57\u81ea\u5b9a\u4e49\uff0c\u5b9a\u4e49\u5728\u7236\u5bb9\u5668\u4e0a<br \/>\n.box2 div:nth-child(1){grid-area:a1;}<br \/>\n.box2 div:nth-child(2){grid-area:a2;}<br \/>\n.box2 div:nth-child(3){grid-area:a3;}<br \/>\n\/\/\u8ddf\u7236\u5bb9\u5668\u540d\u5b57\u5bf9\u5e94\u4e0a\uff0c\u5199\u5728\u5b50\u9879<br \/>\n\u7b80\u5199\uff1a<br \/>\n.box2{<br \/>\ngrid-template:<br \/>\n&#8220;a1 a1 a1&#8221; 1fr<br \/>\n&#8220;a2 a2 a3&#8221; 1fr<br \/>\n&#8220;a2 a2 a3&#8221; 1fr<br \/>\n\/1fr 1fr 1fr;}<br \/>\n.box2 div:nth-child(1){grid-area:a1;}<\/p>\n<hr \/>\n<p>grid-column-gap(\u5de6\u53f3\u95f4\u8ddd)<br \/>\ngrid-row-gap(\u4e0a\u4e0b\u95f4\u8ddd)<\/p>\n<p>grid-column-gap\u548cgrid-row-gap\u5c5e\u6027\u7528\u6765\u5b9a\u4e49\u7f51\u683c\u4e2d\u7f51\u683c\u95f4\u9699\u7684\u5c3a\u5bf8\u3002<br \/>\nCSSgrid-gap\u5c5e\u6027\u662fgrid-column-gap\u548cgrid-row-gap\u5c5e\u6027\u7684\u7f29\u5199\u3002<br \/>\ngrid-gap<br \/>\ngrid-gap: \u4e0a\u4e0b\u95f4\u8ddd \u5de6\u53f3\u95f4\u8ddd<\/p>\n<hr \/>\n<p>justify-items\u6a2a\u5411(\u4e0a\u4e0b)<br \/>\nalign-items\u7eb5\u5411(\u5de6\u53f3)<br \/>\nplace-items<\/p>\n<p>justify-items\u6307\u5b9a\u4e86\u7f51\u683c\u5143\u7d20\u7684\u6c34\u5e73\u5448\u73b0\u65b9\u5f0f\uff0c\u662f\u6c34\u5e73\u62c9\u4f38\u663e\u793a\uff0c\u8fd8\u662f\u5de6\u4e2d\u53f3\u5bf9\u9f50\u3002<br \/>\nalign-items\u6307\u5b9a\u4e86\u7f51\u683c\u5143\u7d20\u7684\u5782\u76f4\u5448\u73b0\u65b9\u5f0f\uff0c\u662f\u5782\u76f4\u62c9\u4f38\u663e\u793a\uff0c\u8fd8\u662f\u4e0a\u4e2d\u4e0b\u5bf9\u9f50\u3002<br \/>\nplace-items\u53ef\u4ee5\u8ba9align-items\u548cjustify-items\u5c5e\u6027\u5199\u5728\u5355\u4e2a\u58f0\u660e\u4e2d\u3002<\/p>\n<p>\u53d6\u503c<br \/>\nstretch\uff0c\u9ed8\u8ba4\u503c\uff0c\u62c9\u4f38\u3002\u6c34\u5e73\u6216\u5782\u76f4\u586b\u5145<br \/>\nstart \u5bb9\u5668\u5de6\u4fa7\u6216\u9876\u90e8\u5bf9\u9f50<br \/>\nend \u5bb9\u5668\u53f3\u4fa7\u6216\u5e95\u90e8\u5bf9\u9f50<br \/>\ncenter \u6c34\u5e73\u6216\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50<br \/>\nplace-items: \u7eb5\u5411 \u6a2a\u5411<\/p>\n<hr \/>\n<p>justify-content<br \/>\nalign-content<br \/>\nplace-content<\/p>\n<p>justify-content\u6307\u5b9a\u4e86\u7f51\u683c\u5143\u7d20\u7684\u6c34\u5e73\u5206\u5e03\u65b9\u5f0f\u3002<br \/>\nalign-content\u6307\u5b9a\u4e86\u7f51\u683c\u5143\u7d20\u7684\u5782\u76f4\u5206\u5e03\u65b9\u5f0f\u3002<br \/>\nplace-content\u53ef\u4ee5\u8ba9align-content\u548cjustify-content\u5c5e\u6027\u5199\u5728\u4e00\u4e2aCSS\u58f0\u660e\u4e2d\u3002<\/p>\n<p>\u53d6\u503c<br \/>\nstretch\uff0c\u9ed8\u8ba4\u503c\uff0c\u62c9\u4f38\u3002\u6c34\u5e73\u6216\u5782\u76f4\u586b\u5145<br \/>\nstart \u5bb9\u5668\u5de6\u4fa7\u6216\u9876\u90e8\u5bf9\u9f50<br \/>\nend \u5bb9\u5668\u53f3\u4fa7\u6216\u5e95\u90e8\u5bf9\u9f50<br \/>\ncenter \u6c34\u5e73\u6216\u5782\u76f4\u5c45\u4e2d\u5bf9\u9f50<br \/>\nspace-between \u4e24\u7aef\u5bf9\u9f50<br \/>\nspace-aroun \u4eab\u6709\u72ec\u7acb\u4e0d\u91cd\u53e0\u7684\u7a7a\u767d\u7a7a\u95f4<br \/>\nspace-evenly \u5e73\u5747\u5206\u914d\u7a7a\u767d\u7a7a\u95f4<\/p>\n<hr \/>\n<p>\u4f5c\u7528\u5728grid\u5b50\u9879\u4e0a<br \/>\ngrid-column-start:2<br \/>\n\u6c34\u5e73\u65b9\u5411\u4e0a\u5360\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e<br \/>\ngrid-column-end:3<br \/>\n\u6c34\u5e73\u65b9\u5411\u4e0a\u5360\u636e\u7684\u7ed3\u675f\u4f4d\u7f6e(span\u5c5e\u6027)<br \/>\ngrid-column<br \/>\n\u7b80\u5199\uff1agrid-column-start\/grid-column-end<br \/>\ngrid-column\uff1a2\/3<\/p>\n<p>grid-row-start:2<br \/>\n\u5782\u76f4\u65b9\u5411\u4e0a\u5360\u636e\u7684\u8d77\u59cb\u4f4d\u7f6e<br \/>\ngrid-row-end: span 2\/\/span\u4ee3\u8868\u662f\u4e2a\u6570<br \/>\n\u5782\u76f4\u65b9\u5411\u4e0a\u5360\u636e\u7684\u7ed3\u675f\u4f4d\u7f6e(span\u5c5e\u6027)<br \/>\ngrid-row<br \/>\n\u7b80\u5199\uff1agrid-row-start\/grid-row-end<br \/>\ngrid-row\uff1a2\/span 2<\/p>\n<p>grid-area<br \/>\n\u8868\u793a\u5f53\u524d\u7f51\u683c\u6240\u5360\u7528\u7684\u533a\u57df\uff0c\u540d\u5b57\u548c\u4f4d\u7f6e\u4e24\u79cd\u8868\u793a\u65b9\u6cd5<br \/>\ngrid-area:\u6c34\u5e73\u8d77\u59cb\/\u5782\u76f4\u8d77\u59cb\/\u6c34\u5e73\u7ed3\u675f\/\u5782\u76f4\u7ed3\u675f<br \/>\ngrid-area:3\/2\/4\/4<\/p>\n<p>justify-self<br \/>\n\u5355\u4e2a\u7f51\u683c\u5143\u7d20\u7684\u6c34\u5e73\u5bf9\u9f50\u65b9\u5f0f<br \/>\nalign-self<br \/>\n\u5355\u4e2a\u7f51\u683c\u5143\u7d20\u7684\u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f<br \/>\nplace-self<br \/>\n\u7b80\u5199place-self\uff1aalign-self\u00a0 justify-self<\/p>\n<hr \/>\n<p>\u7528\u7f51\u683c\u5e03\u5c40\u5b8c\u6210\u9ab0\u5b50<br \/>\n\u6837\u5f0f\uff1a<\/p>\n<p>.box{width: 400px;margin: 100px auto;}<br \/>\n.boxs{width: 100px;height: 100px;border: 1px solid;border-radius: 8px;<br \/>\ndisplay: grid;place-items:center center;<br \/>\ngrid-template-columns: repeat(3,1fr);<br \/>\ngrid-template-rows: repeat(3,1fr);<br \/>\ngrid-template-areas:<br \/>\n&#8220;a1 a2 a3&#8221;<br \/>\n&#8220;a4 a5 a6&#8221;<br \/>\n&#8220;a7 a8 a9&#8243;;<br \/>\n}<br \/>\n.box1,.box2,.box3,.box4,.box5,.box6{float: left;}<br \/>\n.boxs div{width: 30px;height: 30px;background-color: black;border-radius: 50%;}<br \/>\n.box1 div{grid-area: a5}<\/p>\n<p>.box2 div:last-child{grid-area: a9}<\/p>\n<p>.box3 div:nth-child(2){grid-area: a5}<br \/>\n.box3 div:nth-child(3){grid-area: a9}<\/p>\n<p>.box4 div:nth-child(2){grid-area: a3}<br \/>\n.box4 div:nth-child(3){grid-area: a7}<br \/>\n.box4 div:nth-child(4){grid-area: a9}<\/p>\n<p>.box5 div:nth-child(2){grid-area: a3}<br \/>\n.box5 div:nth-child(3){grid-area: a5}<br \/>\n.box5 div:nth-child(4){grid-area: a7}<br \/>\n.box5 div:nth-child(5){grid-area: a9}<\/p>\n<p>.box6 div:nth-child(2){grid-area: a3}<br \/>\n.box6 div:nth-child(3){grid-area: a4}<br \/>\n.box6 div:nth-child(4){grid-area: a6}<br \/>\n.box6 div:nth-child(5){grid-area: a7}<br \/>\n.box6 div:nth-child(6){grid-area: a9}<\/p>\n<p>\u5e03\u5c40\uff1a<br \/>\n&lt;div class=&#8221;box&#8221;&gt;<br \/>\n&lt;div class=&#8221;box1 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;box2 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;box3 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;box4 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;box5 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;box6 boxs&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/1.png\" width=\"100%\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/2.png\" width=\"100%\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/3.png\" width=\"100%\" \/><\/p>\n<hr \/>\n<p>\u7528\u7f51\u683c\u5e03\u5c40\u5b8c\u6210\u767e\u5ea6\u98ce\u4e91\u699c<\/p>\n<p>&lt;style&gt;<br \/>\n.box{width: 300px;height: 300px;margin: 50px auto;display: grid;<br \/>\ngrid-template-columns: repeat(3,1fr);<br \/>\ngrid-template-rows: repeat(4,1fr);<br \/>\ngrid-gap: 6px 6px;<br \/>\ngrid-template-areas:<br \/>\n&#8220;a1 a2 a2&#8221;<br \/>\n&#8220;a3 a2 a2&#8221;<br \/>\n&#8220;a4 a4 a5&#8221;<br \/>\n&#8220;a6 a7 a7&#8243;;<br \/>\n}<br \/>\n.box div{background-color: red;}<br \/>\n.box div:nth-child(1){grid-area: a1}<br \/>\n.box div:nth-child(2){grid-area:a2}<br \/>\n.box div:nth-child(3){grid-area:a3}<br \/>\n.box div:nth-child(4){grid-area:a4}<br \/>\n.box div:nth-child(5){grid-area:a5}<br \/>\n.box div:nth-child(6){grid-area:a6}<br \/>\n.box div:nth-child(7){grid-area:a7}<br \/>\n&lt;\/style&gt;<\/p>\n<p>&lt;div class=&#8221;box&#8221;&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;div&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n<img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/4.png\" width=\"100%\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/5.png\" width=\"100%\" \/><br \/>\n<img decoding=\"async\" src=\"http:\/\/image.evshou.com\/2020\/07\/27\/6.png\" width=\"100%\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>grid\u7f51\u683c\u5e03\u5c40 grid\u7f51\u683c\u5e03\u5c40\u662f\u4e00\u4e2a\u4e8c\u7ef4\u7684\u5e03\u5c40\u65b9\u6cd5\uff0c\u7eb5\u6a2a\u4e24\u4e2a\u65b9\u5411\u603b\u662f\u540c\u65f6\u5b58\u5728 \u4f5c\u7528\u5728grid\u5bb9\u5668\u4e0a gri [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1578","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/1578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1578"}],"version-history":[{"count":8,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/1578\/revisions"}],"predecessor-version":[{"id":1805,"href":"https:\/\/www.9713job.com\/index.php?rest_route=\/wp\/v2\/posts\/1578\/revisions\/1805"}],"wp:attachment":[{"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.9713job.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}