How to do a `float: left` with no wrapping?

后端 未结 3 1744
孤城傲影
孤城傲影 2021-01-31 09:24

I have a container box1 that has a certain width (which might change depending on its content). That box contains box2 which has a fixed width (it coul

3条回答
  •  名媛妹妹
    2021-01-31 09:52

    You need box 3 to be a block level element, so use display:block and then toss in an overflow:hidden in conjunction with float-ing box 2:

    
    
        
            
            
            
            How to do a `float: left` with no wrapping?
        
        
            
    2 3
    3
    3
    3
    3
    3
    3
    3
    3
    3
    3
    3

    Amazing all the things overflow:hidden can do :D

提交回复
热议问题