-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Added sticky position term to CSS concepts #5519
base: main
Are you sure you want to change the base?
Conversation
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.
Hey @melan-variya, thanks for the contribution, I have reviewed it and have some suggestions. Please have a look and do the required changes, and let me know if you have any questions or need my help.
@@ -0,0 +1,47 @@ | |||
--- | |||
Title: 'sticky' |
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.
The title should be in the title case.
Title: 'sticky' | |
Title: 'Sticky' |
@@ -0,0 +1,47 @@ | |||
--- | |||
Title: 'sticky' | |||
Description: 'Defines an element that toggles between relative and fixed position, depending on the scroll.' |
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.
The description can be a little more clear -
Description: 'Defines an element that toggles between relative and fixed position, depending on the scroll.' | |
Description: 'Defines an element that toggles between relative and fixed positions depending on the scroll position.' |
- 'CSS' | ||
Tags: | ||
- 'Positioning' | ||
- 'Sticky' |
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.
Sticky is not a valid tag. Please refer to tags from tags.md.
Here is a suggestion -
- 'Sticky' | |
- 'CSS' |
Description: 'Defines an element that toggles between relative and fixed position, depending on the scroll.' | ||
Subjects: | ||
- 'Web Development' | ||
- 'CSS' |
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.
CSS is not a valid subject. Please choose subjects from subjects.md.
Here is a suggestion -
- 'CSS' | |
- 'Web Design' |
where `<value>` and `<percentage>` can be one of the following: | ||
- Length value : `25px` | ||
Specifies a fixed length, such as pixels or any other unit of measure (e.g., `em`, `rem`, `vh`). | ||
|
||
- Percentage value : `5%` | ||
Defines a percentage of the containing block's size. For example, a percentage of the width or height of the nearest positioned ancestor. |
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.
This does not align with the position: sticky
property directly. These values are associated with thresholds like top, bottom, etc. This needs clarification.
where `<value>` and `<percentage>` can be one of the following: | |
- Length value : `25px` | |
Specifies a fixed length, such as pixels or any other unit of measure (e.g., `em`, `rem`, `vh`). | |
- Percentage value : `5%` | |
Defines a percentage of the containing block's size. For example, a percentage of the width or height of the nearest positioned ancestor. | |
The `position: sticky` property is often used with length or percentage values applied to `top`,` right`, `bottom`, or `left` to define the threshold for switching between relative and fixed positioning. |
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.
This can be a little confusing to the learner, so I suggest skipping it for this document.
**Note:** | ||
The `position: sticky` property allows an element to switch between relative and fixed positioning based on the scroll position. It remains in its normal flow until a defined threshold (like `top` or `bottom`) is reached. For it to work, the containing block must have a defined height, and the sticky element should not be obscured by other positioned elements. |
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.
A "note" uses the Markdown blockquote (>) format followed by the word "Note:" Also, there is repetition of the description here.
**Note:** | |
The `position: sticky` property allows an element to switch between relative and fixed positioning based on the scroll position. It remains in its normal flow until a defined threshold (like `top` or `bottom`) is reached. For it to work, the containing block must have a defined height, and the sticky element should not be obscured by other positioned elements. | |
> **Note:** To ensure `position:sticky` works, the containing block must have a defined height, and the sticky element should not be covered by other positioned elements. |
} | ||
``` | ||
|
||
![This behavior is clearly shown in the GIF.](https://raw.githubusercontent.com/Codecademy/docs/main/media/StickyHeaderExample.gif) |
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.
The description should be more descriptive about what is actually happening in the image.
Also, the image file name should be in lowercase, separated with dashes.
![This behavior is clearly shown in the GIF.](https://raw.githubusercontent.com/Codecademy/docs/main/media/StickyHeaderExample.gif) | |
![The GIF illustrates how the header element remains sticky at the top of the viewport during scrolling.](https://raw.githubusercontent.com/Codecademy/docs/main/media/sticky-header-example.gif) |
Description
Added a new entry about how the
position: sticky
property works in CSS. Edited theposition.md
file and added more examples to improve the documentation.Issue Solved
closses #5447
Type of Change
Checklist
main
branch.Issues Solved
section.