4 ms·
I'm still waiting for "display:div" to roll out.
by return0 10y ago
I'm still waiting for "display:div" to roll out.
- bromuro 10y agoIt's called `display: block` - in sake of consistency :)
- c-smile 10y ago`display:block` does not define layout model of element content so I suspect it is not an intent of the author. This div { display:block } div > * { display:block; } is closer but still far from ideal: e.g. it will force all tables to lose their display:table; or lists to lose display:list-item; As far as I understand author is looking for div { flow:vertical; } But that's available only in Sciter.
- olavk 10y agoI'm not sure I understand what you are trying to achieve differently from regular display:block?
- c-smile 10y agoConsider following markup: <div> some text <foo>first</foo><bar>second</bar> </div> There is no way in CSS at the moment to define content flow of the div above. The only possible way is to define `display` on its children. Say, you want that div to replace content vertically as if all children are blocks and text runs are wrapped into anonymous paragraphs: <div> <p.anonymous>some text</p> <block.foo>first</block> <block.bar>second</block> </div> That's impossible in modern CSS without redefining `display` in children. But usually you cannot blindly say div > * { display:block;} What if some child uses `display:flex` ? Problem is that `display` defines how element is replaced among its siblings. But not how its children are laid out. At some point it was a proposal to add `display-model` css property. So you can have div { display: block; display-model:flex | table | etc } Without it we have ugly semi-solution of combinatorial explosion: div { display: flex; } div { display: inline-flex; } div { display: table } div { display: inline-table; } div { display: grid; } div { display: inline-grid; } ...
- olavk 10y agoAh OK, I agree this would be useful. I think a newer CSS proposal factors the display property into separate values to declare element flow and element content flow independently.
- c-smile 10y ago"a newer CSS proposal" This is of 2002: http://www.w3.org/TR/2002/WD-css3-box-20021024/#L706 http://www.w3.org/TR/2002/WD-css3-box-20021024/#L706 15 years ago, Carl!
- olavk 10y agoYeah, that draft was abandoned though, but some of the ideas have been incorporated in the CSS3 display model.