Making a div float left, but not “fall” if text is too long

前端 未结 3 2170
一个人的身影
一个人的身影 2021-02-07 11:04

I\'m sorry for the horrible title.

Essentially, I have a containing div which contains two divs with position: relative; and

3条回答
  •  隐瞒了意图╮
    2021-02-07 11:37

    overflow is the magic word.

    You can use it both to get rid of that ugly clearing div, and to have the second div take up whatever space is left next to the float.

    Also, the .content div:last-child rule you have in your CSS applies to the empty clearing div instead of your second column, so it isn't actually doing anything.

    Here's what it will look like (and the updated fiddle):

    
    
    
    
    TestingTestingTestingTesting

提交回复
热议问题