Skip to content

Instantly share code, notes, and snippets.

@kvanbere
Last active November 12, 2017 10:51
Show Gist options
  • Save kvanbere/3d9acf02f0690ee9ad4983bd316df9ad to your computer and use it in GitHub Desktop.
Save kvanbere/3d9acf02f0690ee9ad4983bd316df9ad to your computer and use it in GitHub Desktop.
Jumbotron menu
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
<nav class="navigation">
<ul>
<li>
<a href="#">Library</a>
<div class="subnav">
<div class="container">
<p>Test</p>
</div>
</div>
</li>
<li>
<a href="#">Blog</a>
<div class="subnav">
<div class="container">
<p>Test 2</p>
</div>
</div>
</li>
</ul>
<input class="search" type="text" placeholder="Search .." />
</nav>
</div>
<div class="container">
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
<p>Content</p>
</div>
</body>
</html>
html, body {
margin: 0;
padding: 0;
}
.container {
width: 90%;
max-width: 1200px;
margin: 0 auto;
position: relative;
}
.search {
display: inline-block;
height: 100%;
width: 15%;
max-width: 180px;
padding: 1rem;
}
.navigation {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
background: lightsalmon;
}
.navigation ul {
display: flex;
flex-direction: row;
flex-shrink: 0;
list-style-type: none;
background: lightblue;
padding: 0;
margin: 0;
}
.navigation ul li {
flex: 0 0 auto;
font-size: 2rem;
padding: 1rem 1rem;
}
.navigation ul li:hover .subnav {
display: block;
}
.subnav {
display: none;
z-index: 10;
background: lightgreen;
width: 100vw;
position: absolute;
top: 100%;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
.subnav .container {
background: lightpink;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment