Is there a way to have elements be positioned to the right without removing them from the flow?

后端 未结 6 1607
日久生厌
日久生厌 2021-01-20 05:51

I have a div with some inline elements inside it. I want to put one of the elements on the left and the rest over on the right:

+---------------------------+         


        
6条回答
  •  既然无缘
    2021-01-20 06:09

    One simple solution is to add overflow:autoto the container in order to solve this. This will cause the container to expand to contain its floats but will make scrollbars appear if for some reason someone additionally sets a small height for the container.

    There are also other alternatives that also work and might be better in other cases. See this question and its second answer for a good overview on the problem.

提交回复
热议问题