重阳节是什么生肖| 什么是热性水果| 12388是什么电话| 哀大莫过于心死是什么意思| 考c1驾照需要什么条件| 液蜡是什么| 鬼最怕什么东西| 下巴长硬包是什么原因| 东倒西歪的动物是什么生肖| 肌肉紧张是什么症状| 舌头尖麻木是什么原因| 乳痈是什么意思| 记者学什么专业| 润什么意思| 人为什么会长痣| 什么是朱砂痣| 捭阖是什么意思| 黄绿色是什么颜色| 环球中心有什么好玩的| 魔芋是什么| 冰丝和天丝有什么区别| 有什么工作| 12月27日什么星座| 众所周知是什么生肖| 异想天开什么意思| 马华读什么| 五月十七是什么星座| 银灰色五行属什么| 垂盆草长什么样| 白带带血是什么原因| 蒹葭苍苍是什么意思| 热疹子是什么症状图片| 女性头部出汗吃什么药| 茯苓有什么功效和作用| 一动就出汗吃什么药| 填充鼻子最好的材料是什么| 工伤是什么意思| 肠胃不好吃什么药效果好| 牙疼吃什么药效果最好| 胃酸烧心吃什么药| 诗眼是什么意思| 夏枯草长什么样子| 神经衰弱吃什么药| 什么是德训鞋| 煮玉米放什么好吃| 纱布是什么材质| 中筋面粉适合做什么| 烟草属于什么行业| 7月22日是什么星座| 三个降号是什么调| 什么情什么意| 2018年属什么生肖| 盐酸达泊西汀片是什么药| 黄毛什么意思| 烧伤用什么药| 洋盘是什么意思| 为什么早射| zoom是什么| 狸猫换太子什么意思| 蚝油是干什么用的| 束在什么情况下读su| 怕金病帕金森是什么症状| 传字五行属什么| 维c有什么功效和作用| 怀孕脚浮肿是什么原因引起的| 盐酸左氧氟沙星片治什么病| 吃什么不会便秘| 脱发严重应该去医院挂什么科| 小儿流清鼻涕吃什么药效果好| 耳蜗是什么| 富士山什么时候喷发| 书店买不到的书是什么书| 单子是什么意思| 手腕关节疼痛什么原因引起的| 什么叫眼睛散光| 药师佛手里拿什么法器| mr是什么| 乙肝复查检查什么项目| 生育能力检查挂什么科| 嘴唇起水泡是什么原因| 回声不均匀是什么意思| 乔迁对联什么时候贴| 1月15号是什么星座| 法国公鸡是什么牌子| 双性恋什么意思| 舍本逐末是什么意思| 胃部彩超能检查出什么| 嘈杂纳减是什么意思| 2003年是什么年| 北洋军阀是什么意思| lof是什么基金| 什么茶刮油| 心脏积液吃什么药最好| 白茶泡出来是什么颜色| 早上打嗝是什么原因呢| 点到为止是什么意思| 初级中学是什么意思| 小苏打可以用什么代替| 帆状胎盘是什么意思| 精疲力尽是什么意思| 新生儿吐奶什么原因| 肾炎什么症状| 甘露丸是什么| 眼睛不舒服是什么原因引起的| 中二是什么意思| 吃什么食物降血压最快最好| 胃炎什么症状| 蘑菇什么季节长出来| 三岁看大七岁看老什么意思| 月经稀发是什么意思| 低血压高吃什么药好| 脑供血不足吃什么药好| 幼儿腹泻吃什么食物| 南岳什么山| 火龙果有什么功效| giordano是什么牌子| 抑郁吃什么药| 血糖偏高能吃什么水果和食物最好| 息肉有什么危害| 007最新一部叫什么| 资治通鉴讲的是什么| 江西庐山产什么茶| y是什么元素| 姐夫的爸爸叫什么| 什么叫朋友| 什么是体脂率| 骨质疏松是什么症状| 栉风沐雨是什么意思| 毛豆不能和什么一起吃| 肝区在什么位置| 皇协军是什么意思| 颈部淋巴结肿大是什么原因| 廿二是什么意思| 胚由什么组成| ox什么意思| 走后门什么意思| 红霉素软膏治什么病| 石楠花是什么| 来源朋友验证消息是什么意思| 孕妇抽筋是什么原因引起的| 怀孕吃鹅蛋有什么好处| 周围神经病是什么病| 地心引力是什么意思| 生理期喝什么| 胖次是什么意思| 楚乔传2什么时候上映| 阴道发痒是什么原因| 戒指戴左手食指是什么意思| 孕妇什么情况下打肝素| 软件开发需要学什么| 眼角疼是什么原因| 日新月异是什么意思| 兄弟是什么生肖| 吃什么补眼睛| 南北杏和什么煲汤止咳化痰| 心肌缺血什么症状| 眼睛淤青用什么方法能快点消除| 芒果过敏吃什么药| 什么时候教师节| 手脚麻木吃什么药| 胃疼吐酸水是什么原因| 心绞痛吃什么药最管用| 足底筋膜炎挂什么科| 1898年属什么生肖| 憋是什么意思| 碧玉是什么玉| modal是什么意思| 方法是什么意思| 粗枝大叶是什么意思| 血糖高适合吃什么主食| 肌酐指标高说明什么| 缘起缘灭是什么意思| 你代表什么意思| 骨穿是检查什么的| 睡觉就做梦是什么原因| 肺结核吃什么食物好| 安赛蜜是什么东西| 女人做梦哭醒预示什么| 宝宝吃益生菌有什么好处和坏处| 巧克力囊肿有什么症状表现| 22点是什么时辰| 长河落日圆什么意思| 碱是什么东西| ct 是什么| 什么是环境影响评价| 阴道发痒是什么原因| 肠胃炎需要做什么检查| 手指月牙代表什么意思| 薄荷泡水喝有什么好处| 疾苦的疾是什么意思| 现在干什么挣钱| eblan是什么品牌| 女人排卵期有什么反应| 8月15是什么星座| 草字头有什么字| 阴超是检查什么的| 怀孕第一个月吃什么对胎儿好| 分泌物呈褐色是什么原因| 人活着有什么意思| 蟑螂有什么危害| 草字头见念什么| 90年属什么的生肖| 云丝是什么| 心脏窦性心律什么意思| 烂大街是什么意思| 走马观花的走是什么意思| 减肥期间吃什么主食| 荷花开是什么季节| 梦见自己爬山是什么意思| lee中文叫什么| 胆水的成分是什么| 哥哥的哥哥叫什么| 中国的母亲河是什么河| 咳嗽有血是什么原因| 吃什么受孕率又快又高| 什么天喜地| 阴间到底是什么| 女人右手断掌代表什么| 为什么会胎停| 为什么血液是红色的| ct什么意思| 奔跑的马是什么牌子的车| 提手旁有什么字| 频繁小便是什么原因| 浮躁是什么意思| 什么网站可以看三级片| 为什么会长水泡| 什么叫牙周炎| 鱼油什么时候吃| 樱桃什么季节成熟| 停车坐爱枫林晚的坐是什么意思| 什么危不什么| 慢性鼻炎吃什么药| 贵州有什么特产| 脚有酸臭味是什么原因| 为什么肚子老是胀气| qt是什么| 汉族为什么叫汉族| 李商隐号什么| 伤官代表什么| 中耳炎是什么症状| 怀孕抽烟对孩子有什么影响| 外阴苔癣是一种什么病| 黄芪煲汤和什么搭配| 胸口疼挂什么科室| 7.17是什么日子| 胃胀是什么感觉| 鳞状上皮内高度病变什么意思| 碳是什么| 一个厂一个人念什么| 黄瓜和什么一起炒好吃| 肾病可以吃什么水果| 甲状腺1度肿大是什么意思| 5月3日什么星座| 牙齿有裂纹是什么原因| 长期腹泻是什么病| 团五行属什么| 做梦梦见死去的亲人是什么意思| 尬是什么意思| 耳鸣吃什么中药| 喝茶对人体有什么好处| 受精卵着床有什么感觉| 胸闷气短挂什么科室| 梦见打老公是什么意思| 百度

浙江之声--浙江频道--人民网

CSS Grid and Flexbox brought incredible layout tools to the web, but they don’t yet do everything a designer might want. One of those things is a popular layout pattern called “masonry” or “waterfall,” which currently still requires a Javascript library to accomplish.

Masonry layouts in CSS feature was first proposed by Mozilla and implemented in Firefox behind a flag in 2020. From the beginning, there’s been a hot debate about this mechanism. The WebKit team at Apple picked up where Mozilla left off, implemented the drafted spec, and landed it in Safari Technology Preview 163. This reinvigorated the conversation. By October 2024, there were two competing ideas being debated — to “Just Use Grid” or to create a whole “New Masonry Layout”. We wrote extensively about these ideas in a previous article on this website.

A lot has happened since October. Now, a third path forward is emerging — a path that would mean the CSS Working Group doesn’t choose either “Just Use Grid” or “New Masonry Layout”. It merges ideas from both with a completely-new idea to create a unified system of Item Flow properties. This article explains what Item Flow is, and its impact on both Flexbox and Grid. In Part 2, another article will more fully explain the implications for the future of masonry-style layouts.

The three options for CSS Masonry.

But first, why is a third possibility called Item Flow emerging at all? Why not just pick between the “Just Use Grid” and “New Masonry Layout” options? Well, back in October, the folks working on masonry asked the W3C Technical Architecture Group (TAG) to weigh in on the debate. The TAG had a lengthy response, but one of the most interesting parts was this:

Overall, we think masonry, grid, and wrapping-flexbox should be incorporated into a unified set of properties. Chrome’s [New Masonry Layout] proposal splits apart property sets too eagerly, but even the WebKit [originally Mozilla | Just Use Grid] proposal seems to miss a chance to develop more-general properties.

Wow. Incorporate Flexbox, Grid and Masonry into a unified set of properties? What would that even look like?

The suggestion isn’t to combine all of Flexbox with all of Grid — but rather to create a new set of properties and values to “replace” specifically the flex-flow and grid-auto-flow properties. (You will always be able to use the older syntax if you prefer.) Think how originally the Alignment properties and thegap property were defined to work only in one layout system, and then later got modified and extended to work in multiple layout contexts.

Several of us here at Apple got together and started figuring out how a such unified system for layout *-flow could work. We decided to tentatively name the shorthand item-flow. It’d be the main property from which the longhands and values follow. Together, the new rules would all control the direction of flow, how items wrap, how items pack, whether or not there’s “slack” in the layout, and more.

As we worked through the details, we started to get excited. Suddenly new features for Flexbox and Grid that people have wanted for years had an obvious home. Things seemed to click together elegantly. New capabilities emerged:

  • Flexbox could gain a way to do dense packing
  • Grid could gain the ability to turn off wrapping
  • Masonry layouts could now be triggered with a value for item-flow
  • and more…

In this article, we want to describe Item Flow to you, the people who make websites and web apps, to see what you think. So, let’s go on a journey to imagine what this future would be like…

Combining Flexbox and Grid

Flexbox has flex-flow. It’s a shorthand for these two longhands:

  • flex-direction: row | row-reverse | column | column-reverse;
  • flex-wrap: nowrap | wrap | wrap-reverse;

Flex-direction determines which direction the content flows, while flex-wrap determines whether or not to wrap content.

CSS Grid has grid-auto-flow.

  • grid-auto-flow: row | column | dense;

It determines the direction in which the content flows, and whether or not dense packing is used, all in one property. It has no longhands.

So how shall we unify these capabilities? We proposed calling the new shorthand item-flow, with four new longhands:

  • item-direction
  • item-wrap
  • item-pack
  • item-slack

(It’s important to note all of these are brand new, baby fresh ideas. They will get discussed at length and changed before they become reality in browsers. To make this article readable, we are glossing over the current debates and presenting just one name for each property/value, not listing the all the variations proposed at the CSSWG.)

Item Direction

The item-direction property would determine how content flows. Should content flow in rows or columns? In the normal direction or reversed? This would work just like flex-direction and the corresponding part of grid-auto-flow.

item-direction: row | column | row-reverse | column-reverse

This is pretty straightforward to understand because it works just like we expect from years of working with Flexbox and Grid. There is a debate about what “row” and “column” mean for masonry-style layouts — we’ll get into that in our next article, Item Flow – Part 2: next steps for Masonry.

Item Wrap

The item-wrap property would determine whether or not content will wrap, and if so, in which direction. The new default would be auto — which resolves to nowrap in Flexbox and wrap in Grid, matching the current initial values.

This is familiar territory, but creating a new property gives us the opportunity to clean up the values and make them more sensical. We could add a new reverse keyword, so that [ nowrap | wrap ] is one choice, while [ normal | reverse ] is a second, separate choice, improving on how this currently works in Flexbox. (We could also keep wrap-reverse around for the sake of supporting legacy habits.) This would give us:

item-wrap: auto | nowrap | wrap | normal | reverse

But CSS Grid hasn’t had a concept of nowrap before! So what would that be?!? Here’s one idea…

With Flexbox, there are many use cases for laying out your items in one line, one row, without any wrapping. Perhaps it’s a navigation bar, where each item is a phrase of a different length. The amount of space for each item is determined by the size of that item — you get flexible boxes.

What if you want to lay out all your content in one row, but, instead, for each item to get the same amount of space — for every item to be 1fr wide? Since the size of the columns is extrinsically determined, CSS Grid is the right tool for this job. But because Grid wraps by default, developers often hack Flexbox instead, not realizing they can get the desired effect today with grid-auto-flow: column.

In a future with Item Flow, it’d be very obvious how to use nowrap to tell Grid to fit everything on one line.

.container {
  display: grid;
  grid-auto-columns: 1fr;
  item-wrap: nowrap;
}

Now, if there are nine items, we get nine columns. If there are five items, we get five columns, like this:

A grid of five columns, filled with five items, all in just one row.

Item Pack

The item-pack property would let us switch between different kinds of packing.

Dense packing

In Grid, we currently have the ability to switch to a mode of dense packing, with grid-auto-flow: dense. In the new integrated system, this same capability would be available with item-pack: normal | dense — adding an explicit value for switching back to not-dense for the first time.

Flexbox currently has no concept of dense packing. So what feature could we add to it here?

.container {
  display: flex;
  item-pack: dense;
}

Two ideas have been debated so far:

  1. Dense packing could mean Flexbox will attempt to cram one more item on the row (or column) before starting a new row. It would shrink the items on the row just enough, instead of leaving extra space and growing them.
  2. Or, to behave like Grid, dense packing could mean Flexbox will look back to previous spots in the layout and place smaller items in any available space.

To understand what these option means, let’s review how Flexbox currently works, and then take a look at what dense could do.

Today, when Flexbox starts to lay out content, fills up a row with the items that fit in the available space. When it runs out of space, it wraps (if wrapping is allowed), and fills up the next row… until all the items have a home. And then, it distributes all the extra space according to the flex and Alignment properties. (See these two steps on the left & right of the illustration.)

A diagram of the two stages of Flexbox laying out — the current way it works.

With the first idea listed above, dense packing in Flexbox could instead shrink items just enough to be able to fit one more item on the row, shrinking each item instead of distributing extra space.

A similar diagram, with the changes if Idea 1 is chosen. Instead of being stretched, more items are on each line, shrunk to fit.

With the second idea, to behave more like Grid dense packing, Flexbox could instead rearrange the order of items and back-fill smaller spaces with smaller items. In this case, item 6 and 10 end up out of the normal order, placed on previous rows.

A similar diagram, with the changes if Idea 2 is chosen. Item 6 & 10 are reordered to be visually earlier in the layout.

This second idea would cause smaller items to pile up on the right (on the end edge). Because of this, some folks have wondered if this would be at all useful in practice.

What do you want “dense” to mean for Flexbox? Do you like the first or second idea more — or do you have a third?

Balanced packing

The item-pack property could also allow for new kinds of packing that don’t yet exist. For example, we could invent item-pack: balance.

Currently, Flexbox places items on each line without any regard to what’s happening on the other lines. This can often end up with a very few number of items on the last line.

A diagram of how Flexbox layouts works today. Five items are on the first row, and only one item is in the second row, stretched to span across the whole.

A new balance value could tell the browser to instead balance the items in some fashion, similar to text-wrap: balance, ensuring the last line doesn’t stand out as weird.

.container {
  display: flex;
  item-pack: balance;
}
Now instead, three items are on the first row of the layout, and three items are on the second row. This looks better.

This could be incredibly useful and solve a long-standing frustration with Flexbox.

Collapsed packing

The item-pack property could also give us a new home for the trigger for masonry-style layouts. This is a change from the previous Masonry proposals:

Proposal Trigger for masonry layouts
Just Use Grid grid-template-rows: collapse
New Masonry Layout display: masonry
Item Pack item-pack: collapse

Going in this direction means we might not use either of the triggers for masonry layouts from Just Use Grid or New Masonry Layouts. We could abandon both in favor of this new trigger.

We’ll write more about how collapsed item packing could work for masonry layouts in our next article, Item Flow – Part 2: next steps for Masonry.

Item Slack

The item-slack property would allow you to control just how picky the layout engine is when determining where to put the next item.

For masonry-style layouts, this would be the new name for the property previously discussed as grid-slack or masonry-slack. A default slack of 1em means, “hey, when you are looking to see which column has an empty space closest to the top (as you decide where to put the next item), don’t worry about it if the difference is 1em or less. Just consider those tied.”

For Flexbox, this could set a point to switch from loose packing to cramming in extra item — which is currently set to zero. A value of 1em would mean, if it’s within 1em of fitting, cram it in, otherwise wrap to the next line. This idea could integrate with the first idea for Flexbox dense packing (described above), or replace it entirely.

Maybe -slack is not the best name. You can suggest other words in the CSSWG issue. Perhaps item-tolerance would be better, for example — or threshold, strictness, adjust, sensitivity.

The Overall Plan

Put all of these ideas together, and you get this matrix.

A table showing the list of properties, values, and what they do. Everything here is described in this article.

In case it’s not clear, web developers will be able to use the longhands or the shorthand as desired. You could, for example, define a Flexbox context with:

.container {
  display: flex;
  item-direction: column;
  item-wrap: nowrap;
}

Or get the exact same result with:

.container {
  display: flex;
  item-flow: column nowrap;
}

Of course, this whole idea for Item Flow is still a work in progress. Big changes can still be made. The names are temporary. This article’s description of how works is just the first draft. There are many conversations and many decisions to be had.

What do you think?

We would love to hear what you think about Item Flow.

  • Is this a good idea to combine flex-flow and grid-auto-flow into a unified system?
  • As a developer would you use the new syntax to accomplish the things you do today with flex-flow and grid-auto-flow?
    • item-direction: row | column | row-reverse | column-reverse
    • item-wrap: auto | nowrap | wrap | normal | reverse
    • item-pack: normal | dense
  • What other ideas might you have for combining existing functionality in Flexbox and Grid into a unified system?
  • Are you excited about the possibilities of adding new capabilities to Grid and Flexbox? Which ones have the most potential to help you do your work, and unlock new designs?
    • No wrapping for Grid with: item-wrap: nowrap
    • Dense packing for Flexbox with: item-pack: dense
    • Balanced wrapping for Flexbox with: item-pack: balance
    • Adjusting when content is crammed/not in Flexbox with: item-slack: <length-percentage>
  • What other new ideas might you want to add in this unified system?

We’d love to hear what you think. Find Jen Simmons on Bluesky or Mastodon to share your feedback. Or even better, publish your thoughts in a blog post and share the link. Explore examples. Explain ideas. And let us know if you like this direction. While the CSS Working Group has resolved to pursue Item Flow, there’s still plenty of time to go in another direction if need be once we hear from web developers.

Stay tuned for Item Flow – Part 2: next steps for Masonry to learn more about how all this affects the plans for masonry layouts, and to learn more about the specific debates about how item-flow syntax could work.

屎忽鬼是什么意思 豆干和什么炒好吃 evisu是什么牌子中文 吃什么水果会变白 口腔上火是什么原因
刻意是什么意思 捋捋是什么意思 腹泻什么意思 肠镜挂什么科 什么人容易得心肌炎
黄金分割点是什么 黄山在什么地方 看肠胃挂什么科室 岳云鹏什么学历 狮子座和什么星座不合
防晒衣什么颜色最防晒 进仓是什么意思 丝瓜络有什么作用 松花蛋不能和什么一起吃 曹字五行属什么
尿臭是什么原因男性qingzhougame.com 什么叫做光合作用hcv8jop0ns7r.cn 什么其不什么hcv9jop0ns8r.cn 百花齐放是什么生肖hcv9jop4ns8r.cn 乙肝125阳性是什么意思hcv8jop3ns5r.cn
吃什么补大脑记忆力hcv9jop5ns3r.cn 梦见洪水是什么意思hcv9jop2ns1r.cn 狗刨坑是什么征兆hcv9jop1ns4r.cn pickup是什么意思0297y7.com 小肚右边疼是什么原因hcv9jop8ns3r.cn
法令纹深是什么原因hcv8jop2ns2r.cn 肌酐是检查什么的hcv8jop1ns9r.cn 西洋参可以和什么一起泡水喝hcv8jop9ns7r.cn 膝盖骨质增生用什么药效果好hcv8jop2ns5r.cn 女人胯骨疼是什么原因onlinewuye.com
为什么手老是出汗hcv8jop4ns5r.cn iqr是什么意思hcv8jop3ns9r.cn 带沉香手串有什么好处hcv8jop1ns3r.cn 滋阴潜阳是什么意思hcv8jop1ns8r.cn 熊猫为什么叫熊猫aiwuzhiyu.com
百度