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

后端 未结 6 1510
日久生厌
日久生厌 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 05:58

    When you float elements the parent's height is not calculated. Either you can use the clearfix class, or you can clear floats using the overflow property.

    You can also add

    at the end of your parent div, however this is less semantic the the above solutions.

    However, what you choose to use is really a personal preference.

    Also you might want to try using a grid system. You can try 960 or Bootstrap.

提交回复
热议问题