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

fix: revise information about absolute and fixed #28226

Merged
merged 7 commits into from
Aug 3, 2023
Merged

fix: revise information about absolute and fixed #28226

merged 7 commits into from
Aug 3, 2023

Conversation

CBID2
Copy link
Contributor

@CBID2 CBID2 commented Jul 27, 2023

Description

This PR changes the descriptions of the absolute and fixed values in the documentation about the CSS position property. It also adds information about the creation of a new stacking context and the behavior of margins for these values.

Motivation

This PR aims to help developers gain a clearer understanding of these positioning values.

Additional details

This is the documentation that this PR refers to.

Related issues and pull requests

Fixes #28209

@CBID2 CBID2 requested a review from a team as a code owner July 27, 2023 22:54
@CBID2 CBID2 requested review from chrisdavidmills and removed request for a team July 27, 2023 22:54
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Jul 27, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 27, 2023

Preview URLs

(comment last updated: 2023-08-03 06:11:40)

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

Hi @CBID2 ! Some comments for you to consider.


This value creates a new [stacking context](/en-US/docs/Web/CSS/CSS_positioned_layout/Understanding_z-index/Stacking_context) when the value of `z-index` is not `auto`. The margins of absolutely positioned boxes do not [collapse](/en-US/docs/Web/CSS/CSS_box_model/Mastering_margin_collapsing) with other margins.

- `fixed`

- : The element is removed from the normal document flow, and no space is created for the element in the page layout. The element is positioned relative to its initial [containing block](/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). Its final position is determined by the values of `top`, `right`, `bottom`, and `left`.
- : The element is removed from the normal document flow, and no space is created for the element in the page layout. The element is positioned relative to its viewport [containing block](/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). Its final position is determined by the values of `top`, `right`, `bottom`, and `left`.
Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence now sounds a bit wrong, due to the position of the link. Maybe say

positioned relative to its containing block, which is the viewport in the case of visual media.

?

@@ -40,13 +40,13 @@ position: unset;

- `absolute`

- : The element is removed from the normal document flow, and no space is created for the element in the page layout. The element is positioned relative to its closest positioned ancestor (if any) or to the initial [containing block](/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). Its final position is determined by the values of `top`, `right`, `bottom`, and `left`.
- : The element is removed from the normal document flow, and no space is created for the element in the page layout. The element is positioned relative to its containing block [containing block](/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). Its final position is determined by the values of `top`, `right`, `bottom`, and `left`.
Copy link
Contributor

Choose a reason for hiding this comment

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

The sentence now sounds a bit wrong, due to the position of the link, and I also think it just sounds less useful now. The bit about the closest positioned ancestor is not wrong. If anything, the linked page sounds a bit inaccurate to me. If it doesn't have a positioned ancestor, it is positioned relative to the body element, iirc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok so do you suggest I remove the linked page @chrisdavidmills?

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

Hiya @CBID2! I think what we have here now is OK. I think the fixed description is improved by the addition you've made, and I think the absolute description on this page is OK as-is. The linked containing block page might want a little bit of attention, as I described earlier, maybe at a later date.

I committed a couple of small changes directly to your PR, to fix a link that had become broken, and to remove some word duplication.

Thanks for the contribution, much appreciated.

@chrisdavidmills chrisdavidmills merged commit 4253659 into mdn:main Aug 3, 2023
6 checks passed
@CBID2 CBID2 deleted the changing-documentation-about-css-position-property branch August 3, 2023 06:13
@CBID2
Copy link
Contributor Author

CBID2 commented Aug 3, 2023

Hiya @CBID2! I think what we have here now is OK. I think the fixed description is improved by the addition you've made, and I think the absolute description on this page is OK as-is. The linked containing block page might want a little bit of attention, as I described earlier, maybe at a later date.

I committed a couple of small changes directly to your PR, to fix a link that had become broken, and to remove some word duplication.

Thanks for the contribution, much appreciated.

Thank you for your review @chrisdavidmills

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document content about “position” values "absolute" and "fixed"
2 participants