flexbox

Can flexbox divide items evenly on multiple rows?

旧巷老猫 提交于 2019-12-29 05:03:05
问题 I've played around with responsive flexbox grids, with no media queries. http://jsbin.com/qurumisu/1 (rescale the window to see how it works) It fits as many flex items as it can per row and stretches their width equally to fill the whole line. However, this doesn't help "orphan" items. If the first line fits 5/6 items there is only one left for the second line, making it stretch much wider than it's siblings. I would prefer to avoid this behavior by having the elements divided evenly on the

how to make nested flexboxes work

大憨熊 提交于 2019-12-29 04:30:15
问题 I have a small example of a nested flexbox setup: http://jsfiddle.net/ThomasSpiessens/MUrPj/12/ <div class="box fullSize"> <div class="boxHeader">HEADER</div> <div class="boxContent"> <div class="box fullSize"> <div class="boxHeader moregreen">INNER HEADER</div> <div class="boxContent red">CONTENT CONTENT CONTENT</div> <div class="boxFooter moreblue">INNER FOOTER</div> </div> </div> <div class="boxFooter">FOOTER</div> </div> In this example the following applies: CSS 'box' classes use flexbox

Simulate display: inline in React Native

旧街凉风 提交于 2019-12-29 04:27:25
问题 React Native doesn't support the CSS display property, and by default all elements use the behavior of display: flex (no inline-flex either). Most non-flex layouts can be simulated with flex properties, but I'm flustered with inline text. My app has a container that contains several words in text, some of which need formatting. This means I need to use spans to accomplish the formatting. In order to achieve wrapping of the spans, I can set the container to use flex-wrap: wrap , but this will

When does flex-grow switch to flex-shrink, and vice-versa?

梦想的初衷 提交于 2019-12-29 01:41:22
问题 I don't understand what makes flex items switch from grow to shrink behavior? At first I thought it is the flex-basis value, but what if only one item has it, or none? Also, the specs on flex-basis say: The flex-basis CSS property specifies the flex basis which is the initial main size of a flex item. What does that mean? If I have one item with it, and the rest are default, why is it usually starts a little bigger than the value? Where does the added space come from? 回答1: The flex-basis

Overflow: auto causes vertically centered items to be cut off using Flexbox

瘦欲@ 提交于 2019-12-29 01:40:52
问题 The first link is flexbox 2009 model: http://jsfiddle.net/vLKBV/ <div style="display:-webkit-box;height:100%"> <div style="background:#f00;width:50px"> </div> <div style="display:-webkit-box;-webkit-box-align:center;-webkit-box-pack:center;background:#0f0;-webkit-box-flex:1;overflow-Y:scroll"> <div style="background:#000;width:10px;height:300px"> HELLO </div> </div> <div style="background:#f00;width:50px"> </div> and the second one is the revised 2011 - 2012 version: http://jsfiddle.net/MNRgT

Masonry layout with css3 flex

左心房为你撑大大i 提交于 2019-12-28 13:39:06
问题 I'm trying to make kind of masonry layout of items using display: flex; It's running good until my items has different sizes: here is example: http://jsfiddle.net/2pL3j07x/1/ I want small items below big items to wrap it around (2 items in a 'row' below big item should easly fit but only 1 goes there) Is it possible with css flex to do so? 回答1: I know you don't want to use transforms, but this works exactly as described and actually has better browser support than flexbox does (although as

Tooltip element with absolute positioning being clipped by container with overflow: auto

柔情痞子 提交于 2019-12-28 07:04:35
问题 I have a tooltip in a modal. Is there a way that I can avoid the tooltip from being clipped by a container with overflow on it? I need the modal-dialog to handle content overflow so I cannot remove the overflow: auto from it. body { margin: 0; } .container { display: flex; height: 100vh; align-items: center; justify-content: center; } .modal-dialog { display: block; height: 50%; width: 50%; background: cyan; border: 1px solid; overflow: auto; } .tooltip { position: relative; color: red; text

Tooltip element with absolute positioning being clipped by container with overflow: auto

亡梦爱人 提交于 2019-12-28 07:02:02
问题 I have a tooltip in a modal. Is there a way that I can avoid the tooltip from being clipped by a container with overflow on it? I need the modal-dialog to handle content overflow so I cannot remove the overflow: auto from it. body { margin: 0; } .container { display: flex; height: 100vh; align-items: center; justify-content: center; } .modal-dialog { display: block; height: 50%; width: 50%; background: cyan; border: 1px solid; overflow: auto; } .tooltip { position: relative; color: red; text

Bootstrap 4 make nested row fill parent that has been made to fill viewport height using flex-grow

徘徊边缘 提交于 2019-12-28 06:50:25
问题 Currently, I am have a (class="d-flex flex-column") containing a navbar and a container and this container contains a (class="d-flex flex-column") as well that contains two rows. I use flex-grow to make my container fill the page. I wish to make the second row in this nested container to fill its parent using flex-grow again but it doesn't work. How do I make a nested element grow to fill a parent that has been made made to fill the viewport height using flex-grow in Bootstrap v4? Should I

display: flex not working on Internet Explorer [duplicate]

别等时光非礼了梦想. 提交于 2019-12-28 05:35:13
问题 This question already has answers here : Flexbox code working on all browsers except Safari. Why? (2 answers) Closed 2 years ago . My flex container: .back_pattern { display: flex; display: -ms-flexbox; -ms-flex-pack: center; flex-direction: column; align-content: center; justify-content: center; min-height: 100vh; width: 100%; } On other browsers everything works. ie11 : http://take.ms/68dHo ; chrome : http://take.ms/JhcEH What's problem? 回答1: Internet Explorer doesn't fully support Flexbox