Merge pull request #106 from dm-murphy/feature/grid-exercise-2
Add Holy Grail exercise 2 to Grid exercises
This commit is contained in:
commit
faa47dac62
7 changed files with 182 additions and 0 deletions
27
grid/02-grid-layout-2/README.md
Normal file
27
grid/02-grid-layout-2/README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Responsive Holy Grail Layout with Grid
|
||||||
|
|
||||||
|
This one is easy! We are going to take our Holy Grail Layout from the first exercise and make it responsive. To do this we will simply change our fixed track sizes to be dynamic. Consider this a warmup for the next exercise and make sure your layout is responding properly when resizing the browser window.
|
||||||
|
|
||||||
|
### Hints
|
||||||
|
- You only need to add to the CSS selectors
|
||||||
|
- Use dynamic track sizes for your columns and rows
|
||||||
|
|
||||||
|
## Desired Outcome
|
||||||
|
|
||||||
|
When the browser is narrow:
|
||||||
|
|
||||||
|
![desired outcome narrow](./desired-outcome-narrow.png)
|
||||||
|
|
||||||
|
When the browser is stretched wide:
|
||||||
|
|
||||||
|
![desired outcome wide](./desired-outcome-wide.png)
|
||||||
|
|
||||||
|
### Self Check
|
||||||
|
- The gap is 15px
|
||||||
|
- The grid has two columns
|
||||||
|
- The grid has four rows
|
||||||
|
- The grid tracks do not use static sizes (no pixels!)
|
||||||
|
- The first column is three times larger than the other
|
||||||
|
- The third row is five times larger than the others
|
||||||
|
- The rows and columns stretch wider when making the browser window bigger
|
||||||
|
- The rows and columns stretch taller when making the browser window smaller
|
BIN
grid/02-grid-layout-2/desired-outcome-narrow.png
Normal file
BIN
grid/02-grid-layout-2/desired-outcome-narrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 228 KiB |
BIN
grid/02-grid-layout-2/desired-outcome-wide.png
Normal file
BIN
grid/02-grid-layout-2/desired-outcome-wide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 267 KiB |
23
grid/02-grid-layout-2/index.html
Normal file
23
grid/02-grid-layout-2/index.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!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">
|
||||||
|
<title>Responsive Holy Grail</title>
|
||||||
|
<link rel="stylesheet" href="style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">Header</div>
|
||||||
|
<div class="sidebar">Sidebar</div>
|
||||||
|
<div class="nav">Nav</div>
|
||||||
|
<div class="article">Article
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur bibendum turpis quis interdum semper. Sed at pharetra neque, nec lacinia diam. Suspendisse quis faucibus mi, aliquam porttitor ipsum. Vivamus condimentum eros id mattis pharetra. Duis varius eros nibh. Donec a venenatis eros. Fusce in mauris massa. Donec est metus, rhoncus eu leo sed, aliquet posuere nisl.</p>
|
||||||
|
<p>Cras ut ex in nibh accumsan ullamcorper. Fusce rutrum, metus id porta porttitor, leo ipsum congue velit, eu hendrerit lectus nisi a odio. Pellentesque tristique eros id nibh finibus euismod. Cras suscipit volutpat elit eget pulvinar. Vivamus at blandit leo. Aenean sodales ex non massa efficitur, et egestas neque dapibus. In consequat hendrerit ex, nec finibus magna faucibus eu. Aliquam a libero non erat sollicitudin condimentum. In ac fringilla nisi. Sed pharetra ut turpis id luctus. Proin posuere tortor ac tempus luctus. Donec vitae est et neque faucibus posuere. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
|
||||||
|
</div>
|
||||||
|
<div class="footer">Footer</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
59
grid/02-grid-layout-2/solution/solution.css
Normal file
59
grid/02-grid-layout-2/solution/solution.css
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
padding: 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container div {
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 32px;
|
||||||
|
font-family: Helvetica;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
border-radius: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background-color: #FFDE22;
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
background-color: #FF7755;
|
||||||
|
grid-row: 2 / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav {
|
||||||
|
background-color: #00DDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article {
|
||||||
|
background-color: #bccbde;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article p {
|
||||||
|
font-size: 18px;
|
||||||
|
font-family: sans-serif;
|
||||||
|
color: white;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background-color: #393f4d;
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SOLUTION */
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 3fr;
|
||||||
|
grid-template-rows: 1fr 1fr 5fr 1fr;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
23
grid/02-grid-layout-2/solution/solution.html
Normal file
23
grid/02-grid-layout-2/solution/solution.html
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<!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">
|
||||||
|
<title>Responsive Holy Grail</title>
|
||||||
|
<link rel="stylesheet" href="solution.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">Header</div>
|
||||||
|
<div class="sidebar">Sidebar</div>
|
||||||
|
<div class="nav">Nav</div>
|
||||||
|
<div class="article">Article
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur bibendum turpis quis interdum semper. Sed at pharetra neque, nec lacinia diam. Suspendisse quis faucibus mi, aliquam porttitor ipsum. Vivamus condimentum eros id mattis pharetra. Duis varius eros nibh. Donec a venenatis eros. Fusce in mauris massa. Donec est metus, rhoncus eu leo sed, aliquet posuere nisl.</p>
|
||||||
|
<p>Cras ut ex in nibh accumsan ullamcorper. Fusce rutrum, metus id porta porttitor, leo ipsum congue velit, eu hendrerit lectus nisi a odio. Pellentesque tristique eros id nibh finibus euismod. Cras suscipit volutpat elit eget pulvinar. Vivamus at blandit leo. Aenean sodales ex non massa efficitur, et egestas neque dapibus. In consequat hendrerit ex, nec finibus magna faucibus eu. Aliquam a libero non erat sollicitudin condimentum. In ac fringilla nisi. Sed pharetra ut turpis id luctus. Proin posuere tortor ac tempus luctus. Donec vitae est et neque faucibus posuere. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.</p>
|
||||||
|
</div>
|
||||||
|
<div class="footer">Footer</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
50
grid/02-grid-layout-2/style.css
Normal file
50
grid/02-grid-layout-2/style.css
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
body, html {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
padding: 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container div {
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 32px;
|
||||||
|
font-family: Helvetica;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
border-radius: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background-color: #FFDE22;
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
background-color: #FF7755;
|
||||||
|
grid-row: 2 / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav {
|
||||||
|
background-color: #00DDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article {
|
||||||
|
background-color: #bccbde;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article p {
|
||||||
|
font-size: 18px;
|
||||||
|
font-family: sans-serif;
|
||||||
|
color: white;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background-color: #393f4d;
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
}
|
Loading…
Reference in a new issue