#Dynamic Menubar Height with flexbox
Last active
December 7, 2015 10:54
-
-
Save ariona/a3d3daefc830f87abda8 to your computer and use it in GitHub Desktop.
Dynamic Menubar Height with Flexbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<header class="site-header"> | |
<a class="branding" href="#"><h1>Just Testing</h1></a> | |
<nav class="main-navigation"> | |
<ul class="menu"> | |
<li class="menu-item"><a href="#">Home</a></li> | |
<li class="menu-item menu-item-has-children"><a href="#">Blog</a> | |
<ul class="sub-menu"> | |
<li class="menu-item"><a href="#">Portfolio</a></li> | |
<li class="menu-item"><a href="#">Contact</a></li> | |
</ul> | |
</li> | |
<li class="menu-item"><a href="#">Portfolio</a></li> | |
<li class="menu-item"><a href="#">Contact</a></li> | |
</ul> | |
</nav> | |
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","fontsize":"90","seethrough":"1","prefixfree":"1","page":"css"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*{ | |
margin: 0; | |
padding: 0; | |
font-family: Lato | |
} | |
a{ | |
color: #333; | |
text-decoration: none; | |
} | |
.site-header{ | |
background: #bada55; | |
display: flex; | |
align-items: stretch; | |
justify-content: space-between; | |
} | |
.branding{ | |
display: flex; | |
align-items: center; | |
} | |
.branding h1{ | |
font-size: 18px; | |
padding: 10px 20px | |
} | |
.main-navigation{ | |
display: flex; | |
} | |
.menu{ | |
list-style: none; | |
display: flex; | |
} | |
.menu-item{ | |
display: flex; | |
position: relative; | |
} | |
.menu-item a{ | |
background-color: red; | |
display: flex; | |
align-items: center; | |
padding: 20px; | |
} | |
.sub-menu{ | |
position: absolute; | |
top: 100%; | |
left: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment