Re: [css-display] display: contents and ::before/::after

On 2/9/15, 7:10 PM, "fantasai" <fantasai.lists@inkedblade.net> wrote:

>If an element has 'display: contents', does it still generate
>::before/::after?

If it does (and I’m not sure why it wouldn’t) there are some interesting
implications. In Firefox 38, setting ::before and ::after on a flex item,
then giving the flex item display:contents appears to promote the ::before
and ::after to be flex items:

body {
  display: flex;
}
div {
  display: contents;
}
div::before {
  content: "foo";
  flex: 1;
}
div::after {
  content: "bar";
  flex: 2;
}

<body>
  <div>X</div>
</body>


I assume this would also work for promoting these pseudos to be grid
items, where you could place the pseudos along with other children in
separate grid areas.

Thanks,

Alan

Received on Tuesday, 10 February 2015 03:48:53 UTC