Make div expand to occupy available height of parent container

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

I have this code:

html:

short

Lorem ipsum dolor sit amet, consec
9条回答
  •  一向
    一向 (楼主)
    2021-01-11 10:54

    Well, pretty easy... make

    and put your h3 into it like:

    Short

    now style that move div like so:

    .move{height:100px;}
    

    it workd, you are done :)

    PS: make it with both of your h3s :)

    well, there is a code:

    css:

    .tile{
        height: 300px;
        width: 200px;
        background: #cecece;
        float: left;
        margin: 0 10px 0 0;
    }
    
    .tile h3{
        min-height: 20px;
        max-height: 61px;
        display: inline-block;
        overflow: hidden;
    }
    
    .tile .content{
        height: 162px;
        overflow: hidden;
        margin: 0 10px;
    }
    
    .move{height:100px;}
    

    html:

    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.

提交回复
热议问题