Why do “inline-block” elements in a “nowrap” div overflow?

前端 未结 4 1696
死守一世寂寞
死守一世寂寞 2021-01-11 11:32

The following code causes #headline to overflow #wrapper and I do not understand why this is happening.

HTML:

4条回答
  •  甜味超标
    2021-01-11 12:01

    You need to use "overflow:hidden" in your wrapper element

    #wrapper {
    background: #fea;
    white-space: nowrap;
    width: 50%;
    overflow: hidden;
    

    }

    I updated your sample in jsfiddle http://jsfiddle.net/XjstZ/72/

提交回复
热议问题