How can I send an inner
to the bottom of its parent
?

前端 未结 8 724
执念已碎
执念已碎 2020-11-30 17:25

The div inside another div picture and code below. Because there will be text and images of the parent div. And red div will be the last element of the parent div.

<

8条回答
  •  情歌与酒
    2020-11-30 18:07

    A flexbox way.

    HTML:

    Images, text, buttons oh my!
    Bottom

    CSS:

    .parent {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    
    /*  not necessary, just to visualize it */
    
    .parent {
      height: 500px;
      border: 1px solid black;
    }
    
    
    .parent div {
      border: 1px solid red;
    }
    

    Edit:

    Source - Flexbox Guide

    Browser support for flexbox - Caniuse

提交回复
热议问题