A Pen by rachelandrew on CodePen.
Created
January 31, 2019 03:22
-
-
Save lesssummer/6edd6250d13778e2d5e784604e51a588 to your computer and use it in GitHub Desktop.
Header, as many as will fit, some tall, footer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="wrapper"> | |
| <header class="header">My header</header> | |
| <div class="panel">Panel A</div> | |
| <div class="panel">Panel B</div> | |
| <div class="panel tall-panel">Panel C</div> | |
| <div class="panel">Panel D</div> | |
| <div class="panel">Panel E</div> | |
| <div class="panel">Panel F</div> | |
| <div class="panel tall-panel">Panel G</div> | |
| <div class="panel tall-panel">Panel H</div> | |
| <div class="panel">Panel I</div> | |
| <div class="panel">Panel J</div> | |
| <footer class="footer">My footer</footer> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *, | |
| *:before, | |
| *:after { | |
| box-sizing: border-box; | |
| } | |
| body { | |
| margin: 40px; | |
| font-family: 'Open Sans', 'sans-serif'; | |
| background-color: #fff; | |
| color: #444; | |
| } | |
| h1, | |
| p { | |
| margin: 0 0 1em 0; | |
| } | |
| .wrapper { | |
| max-width: 940px; | |
| margin: 0 20px; | |
| /* display: grid;*/ | |
| grid-gap: 10px; | |
| } | |
| /* no grid support? */ | |
| .wrapper { | |
| display: flex; | |
| flex-wrap: wrap; | |
| } | |
| .wrapper { | |
| display: grid; | |
| margin: 0 auto; | |
| grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); | |
| grid-auto-rows: minmax(150px, auto); | |
| } | |
| .panel { | |
| /* needed for the flex layout*/ | |
| margin-left: 5px; | |
| margin-right: 5px; | |
| flex: 1 1 200px; | |
| } | |
| .tall-panel { | |
| grid-row-end: span 2; | |
| } | |
| .header, | |
| .footer { | |
| margin-left: 5px; | |
| margin-right: 5px; | |
| flex: 0 1 100%; | |
| grid-column: 1 / -1; | |
| } | |
| .wrapper > * { | |
| background-color: #444; | |
| color: #fff; | |
| border-radius: 5px; | |
| padding: 20px; | |
| font-size: 150%; | |
| margin-bottom: 10px; | |
| } | |
| /* We need to set the margin used on flex items to 0 as we have gaps in grid. */ | |
| @supports (display: grid) { | |
| .wrapper > * { | |
| margin: 0; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment