Created
September 26, 2021 18:35
-
-
Save BaseCase/c95f202834f7300b551487c6ba6d3a39 to your computer and use it in GitHub Desktop.
basic centered grid
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"/> | |
<title>Layout demo</title> | |
<style> | |
* { | |
box-sizing: border-box; | |
} | |
html, body { | |
margin: 0; | |
padding: 0; | |
width: 100vw; | |
height: 100vh; | |
} | |
.container { | |
width: 100%; | |
height: 100%; | |
display: grid; | |
grid-template-columns: 150px 150px 150px; | |
grid-template-rows: 150px 150px 150px; | |
column-gap: 15px; | |
row-gap: 10px; | |
place-content: center; | |
} | |
.cell { | |
display: flex; | |
flex-direction: column; | |
justify-content: space-between; | |
} | |
.cell .img-container { | |
width: 100%; | |
overflow: hidden; | |
} | |
.cell .img-container img { | |
width: 100%; | |
object-fit: cover; | |
} | |
.cell.two-wide { | |
grid-column: span 2; | |
} | |
.cell.two-tall { | |
grid-row: span 2; | |
} | |
.cell p { | |
font-family: sans-serif; | |
font-size: 12pt; | |
text-align: center; | |
margin: 0; | |
padding: 0.5em 0 0 0; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="two-wide cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/300/200"/> | |
</div> | |
<p>hello world</p> | |
</div> | |
<div class="cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/200/200"/> | |
</div> | |
<p>forward</p> | |
</div> | |
<div class="two-tall cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/300/600"/> | |
</div> | |
<p>ping</p> | |
</div> | |
<div class="cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/200/200"/> | |
</div> | |
<p>refs</p> | |
</div> | |
<div class="cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/200/200"/> | |
</div> | |
<p>data</p> | |
</div> | |
<div class="cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/200/200"/> | |
</div> | |
<p>git</p> | |
</div> | |
<div class="cell"> | |
<div class="img-container"> | |
<img alt="" src="https://www.fillmurray.com/200/200"/> | |
</div> | |
<p>amp</p> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rendered, this gets you a page that looks like this: