Why does CSS float not change the width of the following div?

后端 未结 3 1602
时光取名叫无心
时光取名叫无心 2020-11-27 08:07

As I understand float:left, it will push the subsequent element to its left rather than on a new line.

In the following example I would expect that the

3条回答
  •  时光取名叫无心
    2020-11-27 08:48

    CSS:

    .inline {
        float:left;
        position:relative;
        width:auto
    }
    
    .yellow {
        background-color:yellow;
        position:relative;
        float:left;
    }
    

    see fiddle

提交回复
热议问题