How to not wrap contents of a div?

前端 未结 6 829
情歌与酒
情歌与酒 2020-12-22 21:33

I\'ve got a fixed-width div with two buttons in it. If the labels of the buttons are too long, they wrap – one button stays on the first line, and the nex

6条回答
  •  一生所求
    2020-12-22 22:00

    Forcing the buttons stay in the same line will make them go beyond the fixed width of the div they are in. If you are okay with that then you can make another div inside the div you already have. The new div in turn will hold the buttons and have the fixed width of however much space the two buttons need to stay in one line.

    Here is an example:

    You may want to consider overflow property for the chunk of the content outside of the parentDiv border.

    Good luck!

提交回复
热议问题