Align an element to bottom with flexbox

前端 未结 8 1984
陌清茗
陌清茗 2020-11-22 15:34

I have a div with some children:

heading 1

heading 2

Some

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-22 16:36

    When setting your display to flex, you could simply use the flex property to mark which content can grow and which content cannot.

    Flex property

    div.content {
     height: 300px;
     display: flex;
     flex-direction: column;
    }
    
    div.up {
      flex: 1;
    }
    
    div.down {
      flex: none;
    }

    heading 1

    heading 2

    Some more or less text

提交回复
热议问题