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

Maintenance: CSS flex guide: updates to guide 1 #34148

Merged
merged 7 commits into from
Jun 17, 2024
Merged

Maintenance: CSS flex guide: updates to guide 1 #34148

merged 7 commits into from
Jun 17, 2024

Conversation

estelle
Copy link
Member

@estelle estelle commented Jun 14, 2024

Flexbox is not longer new, and there have been values and properties added since this guide was written. This update adds the missing values and properties, and just freshens up the guide.

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 05:47
@estelle estelle requested review from bsmth and removed request for a team June 14, 2024 05:47
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/m [PR only] 51-500 LoC changed labels Jun 14, 2024
@estelle estelle changed the title CSS flex guide: updates to guide 1 Maintenance: CSS flex guide: updates to guide 1 Jun 14, 2024
Copy link
Contributor

github-actions bot commented Jun 14, 2024

@estelle estelle mentioned this pull request Jun 14, 2024
29 tasks
@@ -6,17 +6,17 @@ page-type: guide

{{CSSRef}}

The flexible box layout module, usually referred to as flexbox, was designed as a one-dimensional layout model, and as a method that could offer space distribution between items in an interface and powerful alignment capabilities. This article gives an outline of the main features of flexbox, which we will be exploring in more detail in the rest of these guides.
The [flexible box layout](/en-US/docs/Web/CSS/CSS_flexible_box_layout) module, usually referred to as flexbox, is a one-dimensional layout model,distributing space between items in an interface with powerful alignment capabilities. This article gives an outline of the main features of flexbox, which we will be exploring in more detail in the rest of these guides.
Copy link
Member

Choose a reason for hiding this comment

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

Typo, plus a suggestion for readability. I'm not sure about "space between items in an interface", maybe we can drop it? What do you think?

Suggested change
The [flexible box layout](/en-US/docs/Web/CSS/CSS_flexible_box_layout) module, usually referred to as flexbox, is a one-dimensional layout model,distributing space between items in an interface with powerful alignment capabilities. This article gives an outline of the main features of flexbox, which we will be exploring in more detail in the rest of these guides.
The [flexible box layout](/en-US/docs/Web/CSS/CSS_flexible_box_layout) module (usually referred to as flexbox) is a one-dimensional layout model for distributing space between items and includes numerous alignment capabilities. This article gives an outline of the main features of flexbox, which we will explore in more detail in the rest of these guides.

Copy link
Member Author

Choose a reason for hiding this comment

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

completely agree!


To cause wrapping behavior add the property {{cssxref("flex-wrap")}} with a value of `wrap`. Now, should your items be too large to all display in one line, they will wrap onto another line. The live sample below contains items that have been given a width, the total width of the items being too wide for the flex container. As `flex-wrap` is set to `wrap`, the items wrap. Set it to `nowrap`, which is also the initial value, and they will instead shrink to fit the container because they are using initial flexbox values that allows items to shrink. Using `nowrap` would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit.
To cause wrapping behavior add the property {{cssxref("flex-wrap")}} with a value of `wrap`. Now, if your items are too large to all display in one line, they will wrap onto another line. The live sample below contains items that have been given a `width`. The total width of the items is too wide for the flex container. As `flex-wrap` is set to `wrap`, the items wrap. Set it to `nowrap`, which is the initial value, and they will shrink to fit the container. They shrink because they are using initial flexbox values, including `flex-shrink: 1`, that allows items to shrink. Using `nowrap` would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit.
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
To cause wrapping behavior add the property {{cssxref("flex-wrap")}} with a value of `wrap`. Now, if your items are too large to all display in one line, they will wrap onto another line. The live sample below contains items that have been given a `width`. The total width of the items is too wide for the flex container. As `flex-wrap` is set to `wrap`, the items wrap. Set it to `nowrap`, which is the initial value, and they will shrink to fit the container. They shrink because they are using initial flexbox values, including `flex-shrink: 1`, that allows items to shrink. Using `nowrap` would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit.
To cause wrapping behavior add the property {{cssxref("flex-wrap")}} with a value of `wrap`. Now, if your items are too large to all display in one line, they will wrap onto another line. The live sample below contains items that have been given a `width`. The total width of the items is too wide for the flex container. As `flex-wrap` is set to `wrap`, the items wrap across multiple lines. If you set it to `nowrap`, which is the initial value, and they will shrink to fit the container. They shrink because they are using initial flexbox values, including `flex-shrink: 1`, that allows items to shrink. Using `nowrap` would cause an overflow if the items were not able to shrink, or could not shrink small enough to fit.

Should we link "overflow" to something?

Copy link
Member Author

Choose a reason for hiding this comment

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

Linked to the learn explanation of scroll overflow.

@bsmth
Copy link
Member

bsmth commented Jun 14, 2024

Nice improvements, a couple of comments for you to have a look at 👀

@estelle estelle requested a review from bsmth June 14, 2024 19:31
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.

Looking good! Ready to merge when you are 🚢

@estelle estelle merged commit bc1663e into main Jun 17, 2024
9 checks passed
@estelle estelle deleted the flex-guide1 branch June 17, 2024 13:57
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