flexbox

Possible to use CSS Flexbox to stretch elements on every row while maintaining consistent widths? [duplicate]

99封情书 提交于 2020-02-02 17:43:19
问题 This question already has answers here : Targeting flex items on the last or specific row (3 answers) Closed 2 years ago . I'm trying to get a group of div's (with initial widths) to stretch across a container, expanding their widths when needed. This works great using display:flex, however if it wraps onto a new line, I don't want the items on the new line to stretch if there is any remaining space. I want the new line items to keep the same widths as the other elements in the container. For

flex setting items below each other [duplicate]

江枫思渺然 提交于 2020-02-02 13:15:20
问题 This question already has answers here : Is it possible for flex items to align tightly to the items above them? (5 answers) Closed 2 years ago . i'm trying to get to the layout from middle to left as shown in the picture. How can i make the grey div to push itself up using flex? Should i just use fixed position for it? Thought about changing the html to create container div for the orange and grey boxes, but I want to see how to do it without changing the html. @import 'general.css'; @import

The difference between flex-basis auto and 0 (zero) [duplicate]

泄露秘密 提交于 2020-01-31 22:56:45
问题 This question already has answers here : Make flex-grow expand items based on their original size (4 answers) Closed 2 years ago . What is the difference between these two values? I've tested numerous examples and they just give the exact same result... Can someone please give me an example where flex-basis: auto; does not give the same result as flex-basis: 0; 回答1: "0" and "auto" flex-basis will be different in most if not all situations: numeric values are interpreted as specific widths, so

Even Flexbox product grid with left alignment

折月煮酒 提交于 2020-01-31 19:33:10
问题 I'm trying to get a nice Flexbox grid to use with ecommerce products, but can't quite get it to do what I want. Here is a demo http://jsbin.com/acejes/9/edit It may not be possible, I just wanted to check if there's anything else I can do. Here is my aim… Must be a percentage based grid The first and last column flush against the sides of the container The last row "floats" left My question is kind of similar to How to align left last row/line in multiple line flexbox, but I specifically want

How to control child div height of a flex item

孤者浪人 提交于 2020-01-31 18:33:49
问题 Descriptive plunker: http://plnkr.co/edit/remH1RtkY1qBk0A7J4Tp?p=preview I have a flexbox container containing two flex items ("header" and "content"). The content div has a single child div that I want to control the height of. But no matter how I set the height of this div, the height stays default. Here's the markup / CSS: <!DOCTYPE html> <html> <head> <style> div { padding:15px; } .container { background-color:gold; height:500px; display:flex; flex-flow:column nowrap; } .header {

flexbox 与 grid 比较

偶尔善良 提交于 2020-01-30 16:13:02
两者各有优势,下面是一个简单比较。 Flexbox 是一维布局,grid 是二维布局。 如果你关注内容在屏幕上的位置,那么 grid 适合你。 如果你的重点在于内容流,那么使用 flexbox 更合适。 浏览器支持上面 flexbox 更好一些。 https://webdesign.tutsplus.com/articles/flexbox-vs-css-grid-which-should-you-use–cms-30184 来源: CSDN 作者: 亮子介 链接: https://blog.csdn.net/henryhu712/article/details/104111584

Evenly Space DIVs Vertically

女生的网名这么多〃 提交于 2020-01-30 04:52:38
问题 I have HTML that looks like the following: <div class="page-break"> <div class="menu-item-div"> <!-- CONTENT WITHIN DIV --> </div> <div class="menu-item-div"> <!-- CONTENT WITHIN DIV --> </div> <div class="menu-item-div"> <!-- CONTENT WITHIN DIV --> </div> </div> Each .menu-item-div I need to be evenly spaced apart vertically to fill the div's height. The div .page-break does have a set height of 210mm. Each .page-break div will have a different number of .menu-item-div within it. I need to

How move 'nav' element under 'navbar-brand' in my Navbar

早过忘川 提交于 2020-01-29 14:28:33
问题 I using Bootstrap 4 and I set navbar-brand to the center and all elements to the right side. I want to set my nav element below navbar-brand . Also, I want to set "login" and "log out" to the right side of the nav , but using mr-auto doesn't work. html: <nav class="navbar navbar-expand-sm navbar-dark bg-dark"> <a href="#" class="navbar-brand">Academind</a> <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu"> <span class="navbar-toggler-icon"></span> </button> <div

How move 'nav' element under 'navbar-brand' in my Navbar

99封情书 提交于 2020-01-29 14:26:45
问题 I using Bootstrap 4 and I set navbar-brand to the center and all elements to the right side. I want to set my nav element below navbar-brand . Also, I want to set "login" and "log out" to the right side of the nav , but using mr-auto doesn't work. html: <nav class="navbar navbar-expand-sm navbar-dark bg-dark"> <a href="#" class="navbar-brand">Academind</a> <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarMenu"> <span class="navbar-toggler-icon"></span> </button> <div

CSS中的各种FC

非 Y 不嫁゛ 提交于 2020-01-28 05:48:46
什么是FC? Formatting Context,格式化上下文,指页面中一个渲染区域,拥有一套渲染规则,它决定了其子元素如何定位,以及与其他元素的相互关系和作用。 BFC 什么是BFC Block Formatting Context,块级格式化上下文,一个独立的块级渲染区域,该区域拥有一套渲染规则来约束块级盒子的布局,且与区域外部无关。 BFC的约束规则 内部的BOX会在垂直方向上一个接一个的放置; 垂直方向上的距离由margin决定。(完整的说法是:属于同一个BFC的俩个相邻的BOX的margin会发生重叠,与方向无关。) 每个元素的左外边距与包含块的左边界相接触(从左到右),即使浮动元素也是如此。(这说明BFC中的子元素不会超出它的包含块,而position为absolute的元素可以超出它的包含块边界); BFC的区域不会与float的元素区域重叠; 计算BFC的高度时,浮动子元素也参与计算; BFC就是页面上的一个隔离的独立容器,容器里面的子元素不会影响到外面的元素,反之亦然; BFC的应用 防止margin发生重叠 防止发生因浮动导致的高度塌陷 怎么生成BFC float的值不为none; overflow的值不为visible; display的值为inline-block、table-cell、table-caption;