Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Created March 5, 2020 10:15
Show Gist options
  • Select an option

  • Save bastienapp/3aa28725f431f543ea2c3d05859951d2 to your computer and use it in GitHub Desktop.

Select an option

Save bastienapp/3aa28725f431f543ea2c3d05859951d2 to your computer and use it in GitHub Desktop.
Quest CSS Flexbox
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Find the precious!</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<nav>
<ul>
<li class="home"><a href="#">FindThePrecious.com</a></li>
<li><a class="active" href="#">Fellows</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</nav>
</header>
<section>
<div class="carousel"></div>
</section>
<section class="banner">
<h2>Fellows wanted dead</h2>
<h4>(or alive if you want to eat them later)</h4>
</section>
<section class="articles">
<article></article>
<article></article>
<article></article>
</section>
<section class="contact">
<h2>Contact us</h2>
<form>
<input type="email" placeholder="@">
<input type="text" placeholder="&#8962;">
<select>
<option>I have seen one of them</option>
<option>...</option>
</select>
<textarea placeholder="Your message"></textarea>
<input class="submit" type="submit" value="Send!">
</form>
</section>
<footer>
<nav>
<ul>
<li><a href="#">About us</a></li>
<li><a href="#">Fellows</a></li>
<li><a href="#">Join our army</a></li>
</ul>
<ul>
<li><a href="#">FAQ</a></li>
<li><a href="#">Reward conditions</a></li>
<li><a href="#">Legal mentions</a></li>
</ul>
<ul class="external-links">
<li><a href="#">Sauron4Ever.com</a></li>
<li><a href="#">Follow him also on twitter</a></li>
</ul>
</nav>
</footer>
</body>
</html>
* {
margin: 0;
padding: 0;
font-family: Arial;
}
body {
display: flex;
flex-direction: column;
align-items: center;
overflow-x: hidden;
}
nav, section, form, footer {
display: flex;
}
header nav a {
display: table-cell;
vertical-align: middle;
text-decoration: none;
color: lightgray;
height: 50px;
padding: 0 20px;
}
header nav .home a {
font-size: 1.4em;
}
header nav ul {
display: flex;
flex-direction: row;
background-color: black;
width: 100vw;
max-width: 900px;
}
header nav li {
list-style: none;
}
header nav a.active, header nav a:hover {
background-color: lightgray;
color: black
}
.carousel {
width: 100vw;
max-width: 900px;
height: 200px;
background-color: lightgray;
}
.banner {
flex-direction: row;
justify-content: center;
align-items: center;
height: 100px;
}
.articles {
width: 96vw;
max-width: 900px;
flex-direction: row;
justify-content: space-evenly;
margin-bottom: 60px;
}
.articles article {
flex-grow: 1;
height: 200px;
margin: 10px;
background-color: lightgray;
}
.banner h2 {
text-align: center;
font-size: 1.4em;
padding-right: 6px;
}
.banner h4 {
font-size: 1em;
font-weight: normal;
}
.contact {
display: flex;
flex-direction: column;
border-top: black 1px solid;
align-items: center;
max-width: 900px;
width: 96vw;
padding-bottom: 20px;
}
.contact h2 {
align-self: flex-start;
font-size: 1.4em;
padding: 20px;
margin-bottom: 10px;
}
form {
display: flex;
flex-direction: column;
width: 90vw;
max-width: 700px;
}
form input, select, textarea {
margin-bottom: 10px;
}
.submit {
align-self: flex-end;
}
footer {
justify-content: center;
width: 100vw;
background-color: black;
}
footer nav {
max-width: 800px;
width: 90vw;
justify-content: space-evenly;
padding: 20px 0;
}
footer ul {
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: center;
}
footer .external-links {
flex-grow: 2;
align-items: flex-end;
}
footer .external-links li {
width: 200px;
}
footer li {
list-style: none;
padding: 4px 0;
}
footer a {
text-decoration: none;
color: lightgray;
font-weight: bold;
}
footer a:hover {
text-decoration: underline;
}
@media screen and (max-width: 768px) {
.articles {
flex-direction: column;
}
footer nav {
flex-direction: column;
align-items: center;
}
footer nav li {
text-align: center;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment