Make div expand to occupy available height of parent container

前端 未结 9 385
别那么骄傲
别那么骄傲 2021-01-11 10:28

I have this code:

html:

short

Lorem ipsum dolor sit amet, consec
9条回答
  •  清酒与你
    2021-01-11 11:11

    Try this use extra div with wrap. h3 & div.content tag are wrapped by extra div and some css to be change as following:

    .tile > div {
      height: calc(100% - 20px);
      margin: 10px;
      overflow: hidden;
      line-height: 22px!important;
    }
    .tile {
      height: 300px;
      width: 200px;
      background: #cecece;
      float: left;
      margin: 0 10px 0 0;
    }
    .tile h3 {
      min-height: 20px;
      display: inline-block;
      overflow: hidden;
      margin: 5px 0;
    }
    .tile .content {
      margin: 0;
    }

    short

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    longLongLong longLongLong longLongLong

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

提交回复
热议问题