Created
May 22, 2022 11:09
-
-
Save Tribhuwan-Joshi/d8be48381e388c98dd63332cb17f97a7 to your computer and use it in GitHub Desktop.
Grid layout
This file contains 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"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="learn.css"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div class="grid-container"> | |
<div class="grid-item"> | |
<p>Odin 1</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 2</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 3</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 4</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 5</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 6</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 7</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 8</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 9</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
<div class="grid-item"> | |
<p>Odin 10</p> | |
<img src="https://i.imgur.com/jkwFqfX.png" alt="top logo" /> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains 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
.grid-container { | |
resize: both; | |
overflow: auto; | |
display: grid; | |
gap: 4px; | |
padding: 4px; | |
border: 1px solid grey; | |
background-color: skyblue; | |
grid-template-rows: 150px 150px; | |
grid-template-columns: 150px 150px 150px 150px 150px; | |
} | |
.grid-item { | |
background-color: #444; | |
text-align: center; | |
color: #ddd; | |
font-family: sans-serif; | |
font-size: 1.5rem; | |
padding: 12px; | |
} | |
p { | |
margin: 12px auto 24px; | |
} | |
img { | |
height: 60px; | |
} |
What is the end result you looking forward to for the layout, I think there's a more easier way to write your grid-template-rows and grid-template-columnsSee some example on StackOverflow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, everything seems to be working well when I opened it on my browser both on Firefox and Brave browser, try opening a new code space in your code pen and paste the code and see