Last baseline alignment

Celebration This web feature is now available in all three major browser engines!
Alignment using the first and last keywords is now available in all major engines. This means that we can use last baseline alignment as another option when aligning gr…


This content originally appeared on web.dev and was authored by Rachel Andrew

Alignment using the first and last keywords is now available in all major engines. This means that we can use last baseline alignment as another option when aligning groups of flex or grid items.

Browser support chrome 108, Supported 108 firefox 52, Supported 52 edge 108, Supported 108 safari 16.2, Supported 16.2

First baseline alignment #

If you set the value of align-items to baseline, the result will be first baseline alignment. Therefore the first baseline of the item you are aligning (described as the alignment subject) will align with the first baseline of the other items in the group. You can see this in the following example, where the first two flex items are aligned using align-items: baseline, so they align along the baseline created by the larger text. The final item is aligned to flex-start and therefore aligns to the start of the flex container.

Last baseline alignment #

When aligning a grid or flex item with the value last baseline, the last baseline of that item will align to the last baseline of the baseline sharing group that it is part of. The following example demonstrates last baseline alignment, with the first flex item aligning with the last line of text in the larger item. The final item in this group is aligned to flex-end, which is the end of the flex container.

Fallback alignment #

If the alignment subject does not have a baseline sharing group to align to, then a fallback alignment will be used. For baseline, and first baseline the fallback alignment is start, and for last baseline the fallback alignment is end.

Photo by Toa Heftiba.


This content originally appeared on web.dev and was authored by Rachel Andrew


Print Share Comment Cite Upload Translate Updates
APA

Rachel Andrew | Sciencx (2023-02-20T00:00:00+00:00) Last baseline alignment. Retrieved from https://www.scien.cx/2023/02/20/last-baseline-alignment/

MLA
" » Last baseline alignment." Rachel Andrew | Sciencx - Monday February 20, 2023, https://www.scien.cx/2023/02/20/last-baseline-alignment/
HARVARD
Rachel Andrew | Sciencx Monday February 20, 2023 » Last baseline alignment., viewed ,<https://www.scien.cx/2023/02/20/last-baseline-alignment/>
VANCOUVER
Rachel Andrew | Sciencx - » Last baseline alignment. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/20/last-baseline-alignment/
CHICAGO
" » Last baseline alignment." Rachel Andrew | Sciencx - Accessed . https://www.scien.cx/2023/02/20/last-baseline-alignment/
IEEE
" » Last baseline alignment." Rachel Andrew | Sciencx [Online]. Available: https://www.scien.cx/2023/02/20/last-baseline-alignment/. [Accessed: ]
rf:citation
» Last baseline alignment | Rachel Andrew | Sciencx | https://www.scien.cx/2023/02/20/last-baseline-alignment/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.