Here is the exact answer to your question. I will leave the old version as an alternative.
Problem
From CSS 2.2 Specification :
In CSS 2.2, the effects of "min-width" and "max-width" on tables, embedded tables, table cells, table columns, and undefined column groups.
So it looks like there is currently no way to add max-width to table-cell . You can add a table-cell to each side of the container and set the width to 1500px in the container using media queries , but this is not preferred since there is a workaround.
Decision
If you want to limit the width of the navigator provided in your link to 1500px, you can add a container , just like you, but the structure of the block should be slightly different.
Now you have:
banner as a tablecontainer as a cell tableheader_branding and nav_primary as blocks inside a cell
Try changing the structure as follows:
banner to blockcontainer to tableheader_branding and nav_primary in table-cells
banner is just a 100% background element.
Then give container a max-width 1500px like you, but remember to also give it 100% width . Otherwize will not try to expand to the full width of the screen, as it should not , but now max-width will be the limiting factor.
Here's a CodePen example presented here , but with a container that limits the width to 1500 pixels.
Your example has changed:
.banner { width: 100%; } .container { max-width: 1500px; width: 100%; height: 160px; margin: auto; overflow: hidden; display: table; } .header_branding, .nav_primary { vertical-align: middle; display: table-cell; } .header_branding { width: 150px; height: 52px; } .nav_primary { text-align: right; } .banner, .container, .header_branding, .nav_primary { background: rgba(0, 0, 0, 0.3); border: 1px dotted red; }
<header class="banner"> <div class="container"> <a class="header_branding" href=""> <img src="" /> </a> <nav class="nav_primary"> [Menu items] </nav> </div> </header>
source share