How to make the float left and float right on the same line?

后端 未结 5 2266
长发绾君心
长发绾君心 2021-02-20 09:26

The Problem:

     **The left part** (#nav ul li) which float: left
     and **the right part** (#nav .search) which float: right
            **are n         


        
5条回答
  •  独厮守ぢ
    2021-02-20 10:02

    The reason it doesn’t work as expected is that the

      on the left is expanding out to the right, thus pushing the content down. The solution might be to set an explicit fixed width for the left and right areas which is what I have done when I have faced this scenario in the past. But will say that a mix of floats and even absolute positioning is what will ultimately work.

提交回复
热议问题