flex-direction

Equal height rows in flex-direction: column

柔情痞子 提交于 2020-01-14 07:37:16
问题 I have a flex layout with two flex items, displayed as rows ( flex-direction: column ). The items should have a minimum height but they should maintain the same height it one of them needs to grow. See this fiddle and decrease the width of the result pane; this forces the second .component element to increase its height, but the height of the first .component element remains the same. Is it possible to force the flex items to maintain the same height? Please note that the main thing in this

Same height for flex items in the flex-direction column flex container

吃可爱长大的小学妹 提交于 2019-12-24 14:27:13
问题 Is there a way to have flex items within a flex container with flex-direction: column have the same height, using css only? <div style="display: flex; flex-direction: column;"> <div class="flex-item"> <!-- other html elements with image, links, button etc. --> </div> <!-- ... --> <div class="flex-item"></div> </div> fiddler: https://jsfiddle.net/hzxa9v54/ 回答1: You will need a script to solve that using Flexbox, here done using jQuery. Updated fiddle Stack snippet (function ($) { // preload

Flex item width flex-direction: column and margin: 0 auto

心已入冬 提交于 2019-12-11 11:14:17
问题 Why doesn't flex item A take the full width of the container when it's set to margin: 0 auto ? jsfiddle .container { display: flex; flex-direction: column; } .a { margin: 0 auto; border: 1px solid red; } .b { border: 1px solid blue; } <div class="container"> <div class="a">A</div> <div class="b">B</div> </div> 回答1: That's how the flexbox layout algorithm works. In this case, the following applies: Flexible Box Layout Module - 8.1. Aligning with auto margins Auto margins on flex items have an