Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS property update: align-items #34142

Merged
merged 5 commits into from
Jun 17, 2024
Merged

CSS property update: align-items #34142

merged 5 commits into from
Jun 17, 2024

Conversation

estelle
Copy link
Member

@estelle estelle commented Jun 14, 2024

Updates to CSS property align-items:

  • text case and links to comply with MDN writing guidelines
  • move flex only values to the end of the values list
  • Add text around example to explain what is going on.
  • hide code not relevant to the property being discussed.
  • add colors to grid and flex so the user can see that the value has changed.

addressed as part of CSS baseline / interop openwebdocs/project#189 - subcomponent openwebdocs/project#202

@estelle estelle requested a review from a team as a code owner June 14, 2024 03:58
@estelle estelle requested review from bsmth and removed request for a team June 14, 2024 03:58
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed labels Jun 14, 2024
Copy link
Contributor

github-actions bot commented Jun 14, 2024

Preview URLs

(comment last updated: 2024-06-17 13:55:36)

@estelle estelle mentioned this pull request Jun 14, 2024
29 tasks

- `flex-start`

- : Used in flex layout only, aligns the flex items flush against the flex container's main-start or cross-start side.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have anything to link to from main-start and cross-start if a reader doesn't know what they are? Same below for main-end and cross-end.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i linked to the flex model in the sentence above

```css
#container {
:where(#container) {
height: 200px;
width: 240px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to make it a little wider? 500px container width and 100px wide children?

Suggested change
width: 240px;
width: 500px;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call.

div > div {
box-sizing: border-box;
border: 2px solid #fff;
width: 50px;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above about making it a little wider

Suggested change
width: 50px;
width: 100px;

```html
<div id="container" class="flex">
<div id="item1">1</div>
<div id="item2">2</div>
<div id="item3">3</div>
<div id="item4">4</div>
<div id="item4">4<br />4</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this? I skipped the prose when looking at the live example at first and thought it was a typo.

Suggested change
<div id="item4">4<br />4</div>
<div id="item4">4<br />(line break)</div>

```css
#container {
:where(#container) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need where()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the specificity of the #container means we can't override any properties with .flex and .grid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to flex, grid

@bsmth
Copy link
Member

bsmth commented Jun 14, 2024

Nice, thank you! A couple of comments for your consideration!

}

.flex {
display: flex;
flex-wrap: wrap;
background-color: #8c8c9f;
border-color: magenta;
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fill, 50px);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think it makes sense to apply the other width changes, I guess we need it here, also

Suggested change
grid-template-columns: repeat(auto-fill, 50px);
grid-template-columns: repeat(auto-fill, 100px);

Copy link
Member Author

@estelle estelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @bsmth for the review.


- `flex-start`

- : Used in flex layout only, aligns the flex items flush against the flex container's main-start or cross-start side.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i linked to the flex model in the sentence above

```css
#container {
:where(#container) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to flex, grid

```css
#container {
:where(#container) {
height: 200px;
width: 240px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call.

@estelle estelle requested a review from bsmth June 14, 2024 18:53
The [CSS](/en-US/docs/Web/CSS) **`align-items`** property sets the {{cssxref("align-self")}} value on all direct children as a group. In Flexbox, it controls the alignment of items on the {{glossary("Cross Axis")}}. In Grid Layout, it controls the alignment of items on the Block Axis within their {{glossary("Grid Areas", "grid area")}}.

The interactive example below demonstrates some of the values for `align-items` using grid layout.
The [CSS](/en-US/docs/Web/CSS) **`align-items`** property sets the {{cssxref("align-self")}} value on all direct children as a group. In flexbox, it controls the alignment of items on the {{glossary("cross axis")}}. In Grid Layout, it controls the alignment of items on the block axis within their {{glossary("grid area")}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [CSS](/en-US/docs/Web/CSS) **`align-items`** property sets the {{cssxref("align-self")}} value on all direct children as a group. In flexbox, it controls the alignment of items on the {{glossary("cross axis")}}. In Grid Layout, it controls the alignment of items on the block axis within their {{glossary("grid area")}}.
The [CSS](/en-US/docs/Web/CSS) **`align-items`** property sets the {{cssxref("align-self")}} value on all direct children as a group. In flexbox, it controls the alignment of items on the {{glossary("cross axis")}}. In Grid Layout, it controls the alignment of items on the block axis within their {{glossary("Grid Areas", "grid area")}}.

glossary link here is broken, it looks like it should be "Grid Areas"

Copy link
Member

@bsmth bsmth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Nice improvements 👍🏻

There's one Glossary link to fix, but leaving a +1. Well done ✔️

@estelle estelle merged commit 24545e8 into main Jun 17, 2024
9 checks passed
@estelle estelle deleted the 202-align-items branch June 17, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants