Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

::before/::after + flexbox in MDN

Tags:

css

I see the following news item on MDN CSS homepage:

Gecko's support of flexible boxes has been adapted to match a recent specification clarification: from Firefox 23 ::before and ::after will be flex items, and as such can be repositioned using order and align-self.
(May 3rd, 2013)

What specification does it refer to?
I cannot find any references to ::before/::after in CSS Flexible Box Layout Module.

like image 758
Andrey Shchekin Avatar asked Sep 20 '13 02:09

Andrey Shchekin


People also ask

How to start with Flexbox in CSS?

To start with flexbox firstly create a flex container. To create a flex container set the display property to flex. flex-direction: The flex-direction is used to define the direction of flexible item. The default axis is horizontal in flexbox, so the items flow into a row.

Is it possible to make a nested flex box?

Nested flex boxes It is possible to create some pretty complex layouts with flexbox. It is perfectly ok to set a flex item to also be a flex container, so that its children are also laid out like flexible boxes. Have a look at complex-flexbox.html (see it live also).

Why Flexbox?

Why Flexbox? For a long time, the only reliable cross-browser compatible tools available for creating CSS layouts were features like floats and positioning. These work, but in some ways they're also limiting and frustrating.

What is flex-direction in Flexbox?

flex-direction: The flex-direction is used to define the direction of flexible item. The default axis is horizontal in flexbox, so the items flow into a row.


1 Answers

This was implemented in bug 867454. Not implementing it was a mistake, as comment #0 tells.

The spec says:

The contents of a flex container consists of zero or more flex items: each in-flow child of a flex container becomes a flex item, and each contiguous run of text that is directly contained inside a flex container is wrapped in an anonymous flex item.

And that does include ::before/::after pseudo elements (at least the mozilla folks interpret it this way now, and I'd concur).

"Firefox 23 for developers" also features this information, explicitly referring to ::before and ::after as "in-flow".

In-flow ::after and ::before pseudo-elements are now flex items (bug 867454).

like image 84
nmaier Avatar answered Sep 25 '22 08:09

nmaier