Basic CSS positioning (fitting children in container)

后端 未结 4 574
我寻月下人不归
我寻月下人不归 2021-01-16 03:57

Very basic CSS question. Given the code shown in http://jsfiddle.net/danwoods/65X7X/ why don\'t the child divs (the colored blocks) fit into the container eleme

4条回答
  •  佛祖请我去吃肉
    2021-01-16 04:42

    You have to float them left:

    http://jsfiddle.net/65X7X/2/

    .container div {
        width: 120px;
        height: 100%;
        display: inline-block;
        float: left;
    }
    

    Hope this helps.

提交回复
热议问题