How to align content of a div to the bottom

后端 未结 26 3078
挽巷
挽巷 2020-11-22 01:13

Say I have the following CSS and HTML code:

26条回答
  •  感动是毒
    2020-11-22 02:01

    All these answers and none worked for me... I'm no flexbox expert, but this was reasonably easy to figure out, it is simple and easy to understand and use. To separate something from the rest of the content, insert an empty div and let it grow to fill the space.

    https://jsfiddle.net/8sfeLmgd/1/

    .myContainer {
      display: flex;
      height: 250px;
      flex-flow: column;
    }
    
    .filler {
      flex: 1 1;
    }
    
    
    Top
    Bottom

    This reacts as expected when the bottom content is not fixed sized also when the container is not fixed sized.

提交回复
热议问题