Flexbox column align self to bottom

后端 未结 7 1437
逝去的感伤
逝去的感伤 2021-01-30 19:53

Im trying to use Flexbox. http://css-tricks.com/almanac/properties/a/align-content/ this shows nice alignment options; but i would actually want a Top-top-bottom situation.

7条回答
  •  一个人的身影
    2021-01-30 20:10

    .message-container {
        display: flex;
        flex-direction: column;
        place-content: flex-end;
        height: -webkit-fill-available;
    }
    
    .message {
        display: table-cell;
    }
    

    Try this. I use it for messenger.

    .container {
      height: 400px;
    }
    
    .message-container {
        display: flex;
        background: #eee;
        flex-direction: column;
        place-content: flex-end;
        height: -webkit-fill-available;
    }
    
    .user-message {
        align-self: flex-start;
        display: table-cell;
        padding: 5px;
        margin: 10px;
        border-radius: 10px;
        background-color: rgba(154, 247, 200, 0.692);
    }
    
    .friend-message {
        align-self: flex-end;
        display: table-cell;
        padding: 5px;
        margin: 10px;
        border-radius: 10px;
        background-color: rgba(169, 207, 250, 0.692);
    }
    Hello!
    Hi.

提交回复
热议问题