Prevent floated divs from wrapping to new line

后端 未结 3 1295
我在风中等你
我在风中等你 2020-12-03 07:27

I\'ve seen this asked a few times on SO, and the same answers are given which do not work on my end in Chrome or Firefox.

I want to make a set of left-floated divs r

3条回答
  •  余生分开走
    2020-12-03 08:10

    Use a second wrapper around the elements with absolute positioning. Then you can just float the individual items.

    
    
    
    Item #1
    Item #2
    Item #3

    You will have to adjust the width of #inner based on the number of items you'll have inside it. This can be done on load if you know the number of items or with javascript after the page loads.

提交回复
热议问题