Skip to content

Instantly share code, notes, and snippets.

@aleroddepaz
Created November 10, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleroddepaz/2c160572224dea49101169f7dd7765e9 to your computer and use it in GitHub Desktop.
Save aleroddepaz/2c160572224dea49101169f7dd7765e9 to your computer and use it in GitHub Desktop.
Flexbox navigation menu
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Flex navigation menu</title>
<style>
body {
font-family: sans-serif;
margin: 0;
}
.navigation {
list-style: none;
margin: 0;
background: deepskyblue;
display: flex;
justify-content: flex-end;
}
.navigation a {
text-decoration: none;
display: block;
padding: 1em;
color: white;
}
.navigation a:hover {
background: #00b7f5;
}
@media all and (max-width: 800px) {
.navigation {
justify-content: space-around;
}
}
@media all and (max-width: 600px) {
.navigation {
flex-flow: column wrap;
padding: 0;
}
.navigation a {
text-align: center;
padding: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.3);
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.navigation li:last-of-type a {
border-bottom: none;
}
}
</style>
</head>
<body>
<ul class="navigation">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Contact</a></li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment