Re:The Anti-Hero of CSS Layout – “display:table” (2014)
by olavk on Saturday February 11, 2017 @01:39PM
(#13623987)
I'm not sure I understand what you are trying to achieve differently from regular display:block?
[ Parent
| on HN ]
Re:The Anti-Hero of CSS Layout – “display:table” (2014)
by c-smile on Saturday February 11, 2017 @02:18PM
(#13624206)
Consider 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; }
...
Re:The Anti-Hero of CSS Layout – “display:table” (2014)
by olavk on Saturday February 11, 2017 @02:44PM
(#13624354)
Ah 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.
Re:The Anti-Hero of CSS Layout – “display:table” (2014)
by c-smile on Saturday February 11, 2017 @03:04PM
(#13624493)
"a newer CSS proposal"
This is of 2002: http://www.w3.org/TR/2002/WD-css3-box-20021024/#L706
15 years ago, Carl!