W3C home > Mailing lists > Public > www-style@w3.org > February 2015

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

From: Alan Stearns <stearns@adobe.com>
Date: Tue, 10 Feb 2015 03:48:22 +0000
To: fantasai <fantasai.lists@inkedblade.net>, "www-style@w3.org" <www-style@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
Message-ID: <D0FFC8C3.23CC1%stearns@adobe.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC