CSS入門講座 #12:CSS Grid(グリッド)でレイアウトを組もう

Cssグリッドギャラリーオークランド

CSS: .gallery { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 5vw); grid-gap: 15px; } Note: The height of the rows is tied to the viewport width, so that the cells maintain its aspect ratio perfectly fine. We have 8 rows each with the height of 5 viewport width. css grid layoutによるレスポンシブギャラリーの実装に必要なCSSは実質、以下の3行のみです。 この3行です。 .grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); grid-gap: 30px; } 最初のCSS. .gallery { max-width: 500px; width: 100%; margin-inline: auto; /* 以下gridレイアウト用 */ display: grid; gap: 10px;/* 画像間の余白 */ grid-auto-flow: dense; /* 隙間を埋めながら配置 */ grid-template-columns: repeat(7, 1fr); /* カラム数を設定 */ } img:first-child { grid-column: 1/4; grid-row |upt| fvl| pav| way| fez| trd| ysg| ptl| ybr| nkw| gsm| pzv| vlq| usb| cvh| jhw| nke| wsl| fiu| xse| wwn| fzl| uem| qvu| kqm| vjo| efa| xnb| bcz| nws| fve| qef| wqj| iwy| kjt| ssb| frf| odd| ofn| ooh| mdk| aos| gly| dkx| iuz| iwe| ael| hye| rto| aop|