CSS Flex Box Layout: full-width row and columns

后端 未结 3 1697
囚心锁ツ
囚心锁ツ 2021-02-06 20:06

Hello fellow programmers!

I\'ve got a simple box-layout which I would love to achieve using flexbox, but I simply can\'t figure it out. It should look like this image.

3条回答
  •  悲&欢浪女
    2021-02-06 20:52

    This is copied from above, but condensed slightly and re-written in semantic terms. Note: #Container has display: flex; and flex-direction: column;, while the columns have flex: 3; and flex: 2; (where "One value, unitless number" determines the flex-grow property) per MDN flex docs.

    #Container {
      display: flex;
      flex-direction: column;
      height: 600px;
      width: 580px;
    }
    
    .Content {
      display: flex;
      flex: 1;
    }
    
    #Detail {
      flex: 3;
      background-color: lime;
    }
    
    #ThumbnailContainer {
      flex: 2;
      background-color: black;
    }

提交回复
热议问题