flexbox

Why doesn't flexbox shrink to fit after wrapping elements? [duplicate]

江枫思渺然 提交于 2020-01-11 09:55:08
问题 This question already has answers here : Make container shrink-to-fit child elements as they wrap (4 answers) CSS when inline-block elements line-break, parent wrapper does not fit new width (2 answers) Closed 10 days ago . I want to have a flex-box with a maximum width that wraps beyond that width, but that also fits the maximum size of any given "row" within the flexbox. The problem I am facing now is that any element that stretches beyond the maximum width and then wraps causes the flexbox

struggling with a nested flexbox grid

白昼怎懂夜的黑 提交于 2020-01-11 09:36:14
问题 i tried to achieve a grid like pattern with a negative margin based grid system (susy) and failed. I tried to use flexbox, but i am not sure if its really possible, i thought the best approach would be 2 columns (side A and B) and give the boxes (1) the flex height of 50% of boxes 2, but it somehow doesn't seem to work. this is as far as i got it working. .block { width: 100%; background: grey } .column { align-content: stretch; display: flex; flex-flow: column wrap; width: 50%; } .box_long {

Why do display: block and display: flex render the same element with a different height?

青春壹個敷衍的年華 提交于 2020-01-11 08:56:12
问题 So I have a div with a span inside. And I'm setting display:block or display:flex on the div, and a small font-size on the span. Surprisingly, this is giving different heights on the div. See the example. If I set the smaller font-size on the body or div then the height of both is equal. But if I set the smaller font-size on the span like in the example, then the divs get different heights. How come? And can I do anything about it? span { font-size: 0.8rem; } div { border: 1px solid; } <div

When flexbox items wrap in column mode, container does not grow its width

血红的双手。 提交于 2020-01-11 06:23:09
问题 I am working on a nested flexbox layout which should work as follows: The outermost level ( ul#main ) is a horizontal list that must expand to the right when more items are added to it. If it grows too big, there should be a horizontal scroll bar. #main { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; /* ...and more... */ } Each item of this list ( ul#main > li ) has a header ( ul#main > li > h2 ) and an inner list ( ul#main > li > ul.tasks ). This inner list is

Center a flex item in a row when there are a different number of items on each side

♀尐吖头ヾ 提交于 2020-01-11 06:20:13
问题 How do I achieve this layout drawn on the picture? E.g. 3 items on left side, one centered, 2 on the right. the ul is the orangish color and the black boxes are the items ul { display: flex; width: 100%; } <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> <li>Item 4</li> <li>Item 5</li> <li>Item 6</li> </ul> 回答1: Flexbox Use 7 items. One in the center. Each side has 3. Hide one on the right with visibility: hidden . If you don't want to add a fake item in the DOM, then use a pseudo-element

Flex items overlapping in Chrome and IE11

被刻印的时光 ゝ 提交于 2020-01-11 05:25:21
问题 I'm trying to create a flexbox layout of fixed height which scrolls the inner content when the inner content is too large. Additionally if the content doesn't cause scrolling I want to fix a div with buttons to the bottom of the container. I have a layout which works perfectly in Firefox but in Chrome it causes the bottom button div to clip on top of the content when it's large enough to cause scrolling. This is the layout rendering properly in Firefox: This is how it renders improperly in

Space between components in React Native styling

有些话、适合烂在心里 提交于 2020-01-11 04:29:04
问题 I have 6 View components (shown in the picture) , I want to have space between all 6 View components. My code: <View style={{flexDirection:'column',flex:6}}> <View style={{flex:2,flexDirection:"row",justifyContent:'space-between'}}> <View style={{backgroundColor:'red',flex:1}}> </View> <View style={{backgroundColor:'blue',flex:1}}> </View> </View> <View style={{flex:2,flexDirection:"row",justifyContent:'space-between'}}> <View style={{backgroundColor:'white',flex:1}}> </View> <View style={

Flexbox. Avoid child with longer height than parent (column direction) [duplicate]

半城伤御伤魂 提交于 2020-01-11 01:30:23
问题 This question already has answers here : How can I get FF 33.x Flexbox behavior in FF 34.x? (3 answers) Closed 4 years ago . I'm scaffolding a basic UI for a site using flexbox. Quite similar to the usual email layout. For some reason the second children( class .main-body , lightseagreen color) of a column-layouted flexbox container( .content-main , plum color) has a bigger height than its parent, which I do not want it to. I made a codepen snippet to show this behaviour. html, body { width:

Flexbox. Avoid child with longer height than parent (column direction) [duplicate]

若如初见. 提交于 2020-01-11 01:30:04
问题 This question already has answers here : How can I get FF 33.x Flexbox behavior in FF 34.x? (3 answers) Closed 4 years ago . I'm scaffolding a basic UI for a site using flexbox. Quite similar to the usual email layout. For some reason the second children( class .main-body , lightseagreen color) of a column-layouted flexbox container( .content-main , plum color) has a bigger height than its parent, which I do not want it to. I made a codepen snippet to show this behaviour. html, body { width:

Flexbox. Avoid child with longer height than parent (column direction) [duplicate]

这一生的挚爱 提交于 2020-01-11 01:29:45
问题 This question already has answers here : How can I get FF 33.x Flexbox behavior in FF 34.x? (3 answers) Closed 4 years ago . I'm scaffolding a basic UI for a site using flexbox. Quite similar to the usual email layout. For some reason the second children( class .main-body , lightseagreen color) of a column-layouted flexbox container( .content-main , plum color) has a bigger height than its parent, which I do not want it to. I made a codepen snippet to show this behaviour. html, body { width: