CSS: bolding some text without changing its container's size

后端 未结 11 1185
生来不讨喜
生来不讨喜 2020-11-29 16:55

I have a horizontal navigation menu, which is basically just a

    with the elements set side-by-side. I do not define width, but simply use padding, bec
11条回答
  •  感动是毒
    2020-11-29 17:45

    Unfortunately the only way to avoid the width changing when the text is bold is to define the width of the list item, however as you stated doing this manually is time consuming and not scalable.

    The only thing I can think of is using some javascript that calculates the width of the tab before it is bold, and then applies the width at the same time the bold is required (either when you hover or click).

提交回复
热议问题