Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between flex-end and end?

When I use the css property align-items, I cannot see any visual difference with the value of flex-end or value of end.

What is the difference between align-items: end and align-items: flex-end?

like image 381
Sølve Tornøe Avatar asked Feb 12 '19 15:02

Sølve Tornøe


People also ask

What is the difference between end and flex-end?

One value ( end ) is defined in the CSS Box Alignment specification, and is intended to apply to multiple box layout models (block, table, grid, flex, etc.) The other value ( flex-end ) is defined in the CSS flexbox specification, and is intended to apply only to flex layout.

What does flex-end mean?

flex-end : items are packed toward to end line. center : items are centered along the line. space-between : items are evenly distributed in the line; first item is on the start line, last item on the end line.

What is difference between start and Flex?

flex-start takes into account the presence of the -reverse values of the flex direction, while start does not.

How do you position a flex-end?

flex-end : lines packed to the end of the container. center : lines packed to the center of the container. space-between : lines evenly distributed; the first line is at the start of the container while the last one is at the end. space-around : lines evenly distributed with equal space between them.


1 Answers

One value (end) is defined in the CSS Box Alignment specification, and is intended to apply to multiple box layout models (block, table, grid, flex, etc.)

The other value (flex-end) is defined in the CSS flexbox specification, and is intended to apply only to flex layout.

With the Box Alignment spec, the W3C is attempting to establish a universal language for the alignment of boxes in CSS. Eventually, the Box Alignment values will supersede the particular values defined in flex, grid and other specs.

For example:

  • end will be used instead of flex-end
  • column-gap will be used instead of grid-column-gap
  • and so on.

Many Box Alignment values are already in use across major browsers. But full implementation is still a ways off, so it's still safer to use flex-end instead of end (and then count on long-term support for legacy names).

Here's an illustration from the Box Alignment spec:

§ 8.3. Legacy Gap Properties: the grid-row-gap, grid-column-gap, and grid-gap properties

The Grid Layout module was originally written with its own set of gutter properties, before all such properties were unified into the existing row-gap / column-gap naming. For compatibility with legacy content, those legacy property names must be supported as aliases:

  • grid-row-gap must be treated as a shorthand for the row-gap property

  • grid-column-gap must be treated as a shorthand for the column-gap property

  • grid-gap must be treated as a shorthand for the gap property

In all three cases, the legacy properties must take the same grammar as the property they are aliasing, and just "forward" the value to their aliased property.

like image 52
Michael Benjamin Avatar answered Sep 20 '22 01:09

Michael Benjamin