How can I include the width of “overflow: auto;” scrollbars in a dynamically sized absolute div?

前端 未结 2 1906
南笙
南笙 2021-01-03 18:32

(First question on Stack Overflow. Hope I\'m doing it right.)

I\'m trying to create a floating menu that inherits its width from its content (since I don\'t know the

2条回答
  •  长发绾君心
    2021-01-03 19:16

    You have a few options.

    Use white-space:nowrap; and some padding.

    Use overflow: scroll;, which adds an extra scrollbar on the bottom, but fixes the wrapping problem in Firefox.

    Use overflow-y:scroll which is CSS3 and is supported by only modern browsers.

提交回复
热议问题