-
Notifications
You must be signed in to change notification settings - Fork 23.1k
fix(docs): Improve fit-content and other sizing keyword pages #40202
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
80c62ec
improve sizing keyword pages
dipikabh 625472d
fix casing
dipikabh 493c142
move related terms to the top
dipikabh 3ee14cc
fix link
dipikabh c5ab5a3
fix review comments
dipikabh f676589
word tweak
dipikabh c509b24
Apply suggestions from review
dipikabh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
improve sizing keyword pages
- Loading branch information
commit 80c62ec7f4be7e09ed54896e5cae697734a9e08e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- | ||
| title: Extrinsic size | ||
| slug: Glossary/Extrinsic_size | ||
| page-type: glossary-definition | ||
| --- | ||
|
|
||
| {{GlossarySidebar}} | ||
|
|
||
| In CSS, the **extrinsic size** is based on the context of an element, without regard for its contents. Extrinsic sizing is determined by box model property values. With extrinsic sizing, percentages specify the size of a box with respect to the box's containing block. | ||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## See also | ||
|
|
||
| - CSS {{cssxref("min-content")}}, {{cssxref("max-content")}}, and {{cssxref("fit-content")}} sizing keywords | ||
| - Related glossary term: {{glossary("Intrinsic size")}} | ||
| - [CSS box sizing](/en-US/docs/Web/CSS/CSS_box_sizing) module | ||
| - [CSS Box Sizing Module Level 3](https://drafts.csswg.org/css-sizing-3/#extrinsic) specification | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,29 +6,42 @@ browser-compat: css.properties.width.fit-content | |||||
| sidebar: cssref | ||||||
| --- | ||||||
|
|
||||||
| The **`fit-content`** keyword is equivalent to {{cssxref("fit-content_function", "fit-content(stretch)")}}. In practice, this means that the box will use the available space, but never more than {{cssxref("max-content")}}. | ||||||
|
|
||||||
| The `fit-content` size is calculated using the following equation, where `<available-space>` is the size of its parent or grid track in [grid layout](/en-US/docs/Web/CSS/CSS_grid_layout/Basic_concepts_of_grid_layout): | ||||||
|
|
||||||
| `min(max-content, max(min-content, <available-space>))` | ||||||
|
|
||||||
| When used as laid out box size for {{cssxref("width")}}, {{cssxref("height")}}, {{cssxref("min-width")}}, {{cssxref("min-height")}}, {{cssxref("max-width")}} and {{cssxref("max-height")}} the maximum and minimum sizes refer to the content size. | ||||||
| The `fit-content` sizing keyword represents an element size that adapts to its content while staying within the limits of its container. | ||||||
| The keyword ensures that the element is never smaller than its minimum intrinsic size ({{cssxref("min-content")}}) or larger than its maximum intrinsic size ({{cssxref("max-content")}}). | ||||||
dipikabh marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| The {{cssxref("interpolate-size")}} property and {{cssxref("calc-size()")}} function can be used to enable animations to and from `fit-content`. | ||||||
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| > [!NOTE] | ||||||
| > The CSS Sizing specification also defines the {{cssxref("fit-content_function", "fit-content()")}} function. This page details the keyword. | ||||||
| > In addition to the `fit-content` keyword, the CSS Box Sizing specification also defines the {{cssxref("fit-content_function", "fit-content()")}} function, which takes a length or percentage as an argument and behaves slightly differently. | ||||||
|
||||||
| > In addition to the `fit-content` keyword, the CSS Box Sizing specification also defines the {{cssxref("fit-content_function", "fit-content()")}} function, which takes a length or percentage as an argument and behaves slightly differently. | |
| > In addition to the `fit-content` keyword, the [CSS box sizing](/en-US/docs/Web/CSS/CSS_box_sizing) module also defines the {{cssxref("fit-content_function", "fit-content()")}} function, which takes a {{cssxref("length")}} or {{cssxref("percentage')}} as an argument and behaves slightly differently. |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do they serve the same purpose?
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
dipikabh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.