I know this is not the web’s most important problem, yet it’s still something that annoys me greatly, so throwing the idea out here.
Problem description
When you have a horizontal navigation menu of which the items are of a variable width, when you change one of the link texts to be bold, this horizontally shifts the items coming after it. This horizontal shift looks cheap and unstable. The reason for the shift is bold text taking up more width, and as a result, the variable width parent element grows.
Current solutions
There’s several solutions/hacks currently in use by developers to work around this problem:
-
Giving items a fixed width (the only non-hack yet design-wise not great and often not possible due to CMS or translations)
-
Tinkering with negative letter-spacing for bold items (very unprecise technique that is highly dependent on the font and possibly even rendering alghoritms. It also changes the look of the text itself)
-
Using a 1px text shadow (looks terrible, this is not the same as real bold rendering)
-
Reserving space for bold using a pseudo element (highly dependent on layout and not possible when pseudo element is already in use for another purpose)
None of these solutions are very satisfactory, yet it is a pretty common problem.
Proposal
The proposal would be to have a way to change font-weight (perhaps even other font styling methods) in such a way that it will render as true bold (therefore the width of the text itself does grow), yet to not grow the size of the parent container, if that parent container width is dynamic.
a:hover {
font-weight: bold !stable
}