How to make a parent div auto size to the width of its children divs

前端 未结 2 1362
失恋的感觉
失恋的感觉 2021-02-01 11:47

I\'m trying to make the parent div only as wide as the child div\'s. Auto width is making the parent div fit the entire screen. The children divs will be different widths depend

2条回答
  •  遥遥无期
    2021-02-01 12:21

    Your interior

    elements should likely both be float:left. Divs size to 100% the size of their container width automatically. Try using display:inline-block instead of width:auto on the container div. Or possibly float:left the container and also apply overflow:auto. Depends on what you're after exactly.

提交回复
热议问题