flexbox

Flexbox - Fill remaining space

纵饮孤独 提交于 2020-01-15 07:04:16
问题 I have a basic flexbox layout like this.. body,html { height:100%; width:100%; } #container { width:100%; background:grey; display:flex; flex-direction:column; } .top { background:red; flex:1; padding:20px; } .bottom { background:yellow; flex:1; padding:20px; } <div id="container"> <div class="top"> Top Content </div> <div class="bottom"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut venenatis, arcu vitae sollicitudin pellentesque, quam libero imperdiet urna, eu rhoncus lorem

How to vertically wrap content with flexbox?

…衆ロ難τιáo~ 提交于 2020-01-15 06:41:50
问题 I have three divs inside a flexbox container. I would like the three divs to be displayed as follows: +-----------------------------------------------+ | +-----------------+-----------------+ | | | | | | | | | | | | +-----------------+-----------------+ | | | | +-----------------------------------+ | | | | | | | | | | +-----------------------------------+ | | | +-----------------------------------------------+ so the container will have to adapt vertically to its content but only to its

React Native: Flex: 1 does not fill width of parent

筅森魡賤 提交于 2020-01-15 06:16:34
问题 I'm using ListItem imported from native-base. ListItem is red and it's child View is yellow. As you can see from the screenshot, View style does not take entire width of ListItem, despite having a flex: 1. How can I make it so that View take entire width of ListItem? See image here <List> <ListItem style={[styles.listitem, { backgroundColor: "red" }]}> <View style={{ flex: 1, flexDirection: "column", backgroundColor: "yellow" }} > <Text style={styles.timeInfoHeader}>{this.props.totalUsage}<

React Native: Flex: 1 does not fill width of parent

烈酒焚心 提交于 2020-01-15 06:16:18
问题 I'm using ListItem imported from native-base. ListItem is red and it's child View is yellow. As you can see from the screenshot, View style does not take entire width of ListItem, despite having a flex: 1. How can I make it so that View take entire width of ListItem? See image here <List> <ListItem style={[styles.listitem, { backgroundColor: "red" }]}> <View style={{ flex: 1, flexDirection: "column", backgroundColor: "yellow" }} > <Text style={styles.timeInfoHeader}>{this.props.totalUsage}<

height: 100% foils flexbox “stick scrollbar to bottom unless moved”

▼魔方 西西 提交于 2020-01-15 04:43:05
问题 I have a terminal-like contentEditable div. I'd like new output to cause it to scroll the window so it is in view, unless the user has manually moved the scroll bar to be viewing another position. In that case, I wish to leave it viewing the position they were at. I'd prefer to avoid doing this with JavaScript hooks or timer callbacks if at all possible. So I was interested in a promising CSS-only solution of using display: flex with flex-direction: column-reverse; . (A comment on that

height: 100% foils flexbox “stick scrollbar to bottom unless moved”

亡梦爱人 提交于 2020-01-15 04:41:28
问题 I have a terminal-like contentEditable div. I'd like new output to cause it to scroll the window so it is in view, unless the user has manually moved the scroll bar to be viewing another position. In that case, I wish to leave it viewing the position they were at. I'd prefer to avoid doing this with JavaScript hooks or timer callbacks if at all possible. So I was interested in a promising CSS-only solution of using display: flex with flex-direction: column-reverse; . (A comment on that

CSS flexbox (flex-grow / flex-basis) - Same width, but doesn't wrap anymore

徘徊边缘 提交于 2020-01-14 10:03:12
问题 I use flexboxes to organize elements on my page. I want the flexboxes to use all available horizontal space, so I add flex-grow:1 . Then I want each item on the same line to be of the same size (e.g. 50% each if there is two items, 33% if there is three, etc), so I add flex-basis:0 . But at the third step, the items don't wrap anymore. If I change the window width, the number of items per line stays always the same, and their content is squeezed. I don't want that. I want an item to be put on

Browser saying that flex-basis: content is “Invalid property value”

时光总嘲笑我的痴心妄想 提交于 2020-01-14 09:01:07
问题 Given: .layout { display: flex; flex-wrap: nowrap; align-items: stretch; } .layout aside, .layout main { min-width: 100px; } .layout aside { flex: 0 0 content; background-color: red; } .layout main { flex: 1 1 content; background-color: green; } <div class="layout"> <aside> <p>Line 1</p> </aside> <main> <p>Line 1</p> <p>Line 2</p> <p>Line 3</p> </main> </div> Live example My intentions are: aside should be as big as the content it contains and never change its width main should take the rest

Single-row grid with height 1fr not filling height in Chrome

时间秒杀一切 提交于 2020-01-14 08:44:08
问题 I have a CSS Grid inside a Flexbox column, and the grid has flex-grow: 1 . In Chrome, the grid expands to fill available space, but its content does not, even with align-content: stretch on the grid. In Firefox and Edge, the content expands to fill the grid's height, as desired. Here's a pen that reproduces the problem, and images of how it looks in different browsers. Is this a bug with Chrome, and if so, can anyone suggest a straightforward workaround? Chrome Firefox Edge #wrapper { display

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