Following this answer I tried to vertically center my header
elements, however I'm having trouble since there's a container
element in between that makes sure they're contained within a certain max-width
and centered. I applied display: table-cell
to this element and now its max-width
doesn't work (occupies the whole screen width regardless of its max-width
). How to solve this problem?
Markup:
<header class="banner">
<div class="container">
<a class="header__branding" href="<?php bloginfo( "wpurl" ); ?>">
<img src="<?php bloginfo( "template_url" ); ?>/dist/images/baia_logo.svg" />
</a>
<nav class="nav_primary">
<?php wp_nav_menu( array( 'menu' => 'main menu' ) ); ?>
</nav>
</div>
</header>
CSS:
.banner {
height: 160px;
width: 100%;
display: table;
background: url(../images/header.jpg) 50% 50% repeat-x;
}
.container {
max-width: 1500px;
margin-left: auto;
margin-right: auto;
overflow: hidden;
vertical-align: middle;
display: table-cell;
}
.header__branding {
float: left;
width: 150px;
height: 52px;
display: block;
}
.nav_primary {
float: right;
}