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

Added sticky position term to CSS concepts #5519

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

melan-variya
Copy link

@melan-variya melan-variya commented Oct 18, 2024

Description

Added a new entry about how the position: sticky property works in CSS. Edited the position.md file and added more examples to improve the documentation.

Issue Solved

closses #5447

Type of Change

  • Adding a new entry
  • Updating the documentation

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@avdhoottt avdhoottt self-assigned this Oct 18, 2024
@avdhoottt avdhoottt added css CSS entries new entry New entry or entries status: under review Issue or PR is currently being reviewed hacktoberfest-accepted Indicates the PR was approved, merged, and pertains to Hacktoberfest labels Oct 18, 2024
@PragatiVerma18 PragatiVerma18 self-assigned this Nov 16, 2024
Copy link
Collaborator

@PragatiVerma18 PragatiVerma18 left a 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'
Copy link
Collaborator

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.

Suggested change
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.'
Copy link
Collaborator

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 -

Suggested change
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'
Copy link
Collaborator

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 -

Suggested change
- 'Sticky'
- 'CSS'

Description: 'Defines an element that toggles between relative and fixed position, depending on the scroll.'
Subjects:
- 'Web Development'
- 'CSS'
Copy link
Collaborator

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 -

Suggested change
- 'CSS'
- 'Web Design'

Comment on lines +23 to +28
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.
Copy link
Collaborator

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.

Suggested change
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.

Copy link
Collaborator

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.

Comment on lines +30 to +31
**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.
Copy link
Collaborator

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.

Suggested change
**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)
Copy link
Collaborator

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.

Suggested change
![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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css CSS entries hacktoberfest-accepted Indicates the PR was approved, merged, and pertains to Hacktoberfest new entry New entry or entries status: review 1️⃣ completed status: waiting for author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants