The below navigation will automatically size itself according to the length/content of the links added to it. The demo below demonstrates the effect when using variable amounts of links and/or variable link text length.
The trick is to use a display table/table-cell properties on the menu and it's list items respectively. This insures that the browser handles the menu items correctly and doesn't rely on awkward margin-calulations, especially with variable amounts of menu items.
Go ahead and try adding/removing menu items to see the effect. You can also adjust your browser window to see how it performs in a responsive scenario or with variable browser widths.
A Pen by Ian Svoboda on CodePen.