add holy-grail
This commit is contained in:
parent
10714f947c
commit
8036b67d5c
|
@ -0,0 +1,32 @@
|
|||
# The Holy Grail of Layout
|
||||
|
||||
In this last flexbox exercise you're going to recreate an incredibly common website layout. It is so common that it is often called the [holy-grail](https://www.google.com/search?q=holy+grail+layout&tbm=isch&sclient=img) layout.... and with flexbox it is actually pretty easy to pull off.
|
||||
|
||||
As with the previous exercise, we've left a little more for you to do.
|
||||
|
||||
### Hints
|
||||
- You will need to change the flex-direction to push the footer down.
|
||||
- You will need to add some divs as containers to get things to line up correctly.
|
||||
- `flex-wrap` will help get the cards aligned correctly.
|
||||
|
||||
## Desired outcome
|
||||
|
||||
![desired outcome](./desired-outcome.png)
|
||||
|
||||
The number of cards lined up in that section will change based on the width of your screen, so don't stress about getting _exactly_ a 3x3 grid.
|
||||
|
||||
on a smaller screen it will look like this:
|
||||
|
||||
![smaller](./desired-outcome-smaller.png)
|
||||
|
||||
### Self Check
|
||||
- Header text is size 32px, weight 900
|
||||
- Header text is vertically centered and 16px from the edge of the screen.
|
||||
- Footer is pushed to bottom of screen (footer may go _below_ the bottom of the screen if the content of the 'cards' section overflows and/or if your screen is shorter)
|
||||
- Footer text is centered horizontally and vertically.
|
||||
- Sidebar and cards take up all available space above the footer.
|
||||
- Sidebar is 300px wide (i.e. it doesn't shrink)
|
||||
- Sidebar links are size 24px, white and do not have the underline text decoration.
|
||||
- Sidebar has 16px padding.
|
||||
- There is 32px padding around the 'cards' section
|
||||
- Cards are arranged horizontally, but wrap to multiple lines when they run out of room on the page
|
Binary file not shown.
After Width: | Height: | Size: 155 KiB |
Binary file not shown.
After Width: | Height: | Size: 148 KiB |
|
@ -0,0 +1,35 @@
|
|||
<!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>The Holy Grail</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
MY AWESOME WEBSITE
|
||||
</div>
|
||||
|
||||
<div class="sidebar">
|
||||
<ul>
|
||||
<li><a href="google.com">⭐ - link one</a></li>
|
||||
<li><a href="google.com">🦸🏽♂️ - link two</a></li>
|
||||
<li><a href="google.com">🖌️ - link three</a></li>
|
||||
<li><a href="google.com">👌🏽 - link four</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempora, eveniet? Dolorem dignissimos maiores non delectus possimus dolor nulla repudiandae vitae provident quae, obcaecati ipsam unde impedit corrupti veritatis minima porro?</div>
|
||||
<div class="card">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quasi quaerat qui iure ipsam maiores velit tempora, deleniti nesciunt fuga suscipit alias vero rem, corporis officia totam saepe excepturi odit ea.</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nobis illo ex quas, commodi eligendi aliquam ut, dolor, atque aliquid iure nulla. Laudantium optio accusantium quaerat fugiat, natus officia esse autem?</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus nihil impedit eius amet adipisci dolorum vel nostrum sit excepturi corporis tenetur cum, dolore incidunt blanditiis. Unde earum minima laboriosam eos!</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nobis illo ex quas, commodi eligendi aliquam ut, dolor, atque aliquid iure nulla. Laudantium optio accusantium quaerat fugiat, natus officia esse autem?</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus nihil impedit eius amet adipisci dolorum vel nostrum sit excepturi corporis tenetur cum, dolore incidunt blanditiis. Unde earum minima laboriosam eos!</div>
|
||||
|
||||
<div class="footer">
|
||||
The Odin Project ❤️
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,87 @@
|
|||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 72px;
|
||||
background: darkmagenta;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.footer {
|
||||
height: 72px;
|
||||
background: #eee;
|
||||
color: darkmagenta;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 300px;
|
||||
background: royalblue;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 2px 4px 16px rgba(0,0,0,.06);
|
||||
border-radius: 4px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
/* SOLUTION */
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
font-size: 32px;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
flex-shrink: 0;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.container {
|
||||
padding: 32px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 16px;
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<!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>The Holy Grail</title>
|
||||
<link rel="stylesheet" href="solution.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
MY AWESOME WEBSITE
|
||||
</div>
|
||||
<div class="body">
|
||||
<div class="sidebar">
|
||||
<ul>
|
||||
<li><a href="google.com">⭐ - link one</a></li>
|
||||
<li><a href="google.com">🦸🏽♂️ - link two</a></li>
|
||||
<li><a href="google.com">🖌️ - link three</a></li>
|
||||
<li><a href="google.com">👌🏽 - link four</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Tempora, eveniet? Dolorem dignissimos maiores non delectus possimus dolor nulla repudiandae vitae provident quae, obcaecati ipsam unde impedit corrupti veritatis minima porro?</div>
|
||||
<div class="card">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quasi quaerat qui iure ipsam maiores velit tempora, deleniti nesciunt fuga suscipit alias vero rem, corporis officia totam saepe excepturi odit ea.</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nobis illo ex quas, commodi eligendi aliquam ut, dolor, atque aliquid iure nulla. Laudantium optio accusantium quaerat fugiat, natus officia esse autem?</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus nihil impedit eius amet adipisci dolorum vel nostrum sit excepturi corporis tenetur cum, dolore incidunt blanditiis. Unde earum minima laboriosam eos!</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Nobis illo ex quas, commodi eligendi aliquam ut, dolor, atque aliquid iure nulla. Laudantium optio accusantium quaerat fugiat, natus officia esse autem?</div>
|
||||
<div class="card">Lorem ipsum dolor sit amet consectetur adipisicing elit. Necessitatibus nihil impedit eius amet adipisci dolorum vel nostrum sit excepturi corporis tenetur cum, dolore incidunt blanditiis. Unde earum minima laboriosam eos!</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
The Odin Project ❤️
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,28 @@
|
|||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 72px;
|
||||
background: darkmagenta;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.footer {
|
||||
height: 72px;
|
||||
background: #eee;
|
||||
color: darkmagenta;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 300px;
|
||||
background: royalblue;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 2px 4px 16px rgba(0,0,0,.06);
|
||||
border-radius: 4px;
|
||||
}
|
Loading…
Reference in New Issue