Why is width: 100% not working on div {display: table-cell}?

前端 未结 7 487
独厮守ぢ
独厮守ぢ 2020-12-25 10:46

I\'m trying to vertically and horizontally center some content overlaying an image slide (flexslider). There were some similar questions to this one, but I couldn\'t find a

7条回答
  •  轮回少年
    2020-12-25 11:19

    How about this? (jsFiddle link)

    CSS

    ul {
        background: #CCC;
        height: 1000%;
        width: 100%;
        list-style-position: outside;
        margin: 0; padding: 0;
        position: absolute;
    }
    li {
     background-color: #EBEBEB;
        border-bottom: 1px solid #CCCCCC;
        border-right: 1px solid #CCCCCC;
        display: table;
        height: 180px;
        overflow: hidden;
        width: 200px;
    }
    .divone{
        display: table-cell;
        margin: 0 auto;
        text-align: center;
        vertical-align: middle;
        width: 100%; 
    
    }
    img {
        width: 100%;
        height: 410px;
    }
    .wrapper {
      position: absolute;
    }
    

提交回复
热议问题