How to make the overflow CSS property work with hidden as value

后端 未结 6 1231
南方客
南方客 2020-11-30 22:21

I am having a tough time with overflow: hidden.

Basically, I am trying to hide the overflow of an unordered list which is located in a

6条回答
  •  时光取名叫无心
    2020-11-30 22:40

    In addition to provided answers:

    it seems like parent element (the one with overflow:hidden) must not be display:inline. Changing to display:inline-block worked for me.

    .outer {
      position: relative;
      border: 1px dotted black;
      padding: 5px;
      overflow: hidden;
    }
    .inner {
      position: absolute;
      left: 50%;
      margin-left: -20px;
      top: 70%;
      width: 40px;
      height: 80px;
      background: yellow;
    }
    
      Some text
      
    
    
      Some text
      
    

提交回复
热议问题