Assessment wanted for positioning skill test 1. (Tasks 1-2)

Assessment wanted for positioning skill test 1. (Tasks 1-2)

Link to task: https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Position_skills#task_1

Links to my code:
Task-1: https://jsfiddle.net/EiNzp/ujw6tz82/
Task-2: https://jsfiddle.net/EiNzp/ou0pkz7x/3/

Thanks :wink:

Hi @EiN

Both tasks are correct. :tada:

In my opinion, for task 2 it would be more appropriate to use position: fixed;, because we don’t need the sticky behavior. (The sticky behavior would be visible if there was additional text above the sidebar.)

Have a nice day,
Michael

1 Like

Hello. I completely agree with you. Initially, I did just that.
But I would like to explain why I then changed it to position: sticky;. I noticed that if the <body> has vertical scrolling, then the .sidebar can go outside of the .container, so I fixed it with position: sticky; and it solved this problem. Now if the <body> gets vertical scroll, then the .sidebar still stays inside the .container. I understand that here it was deprivation, and probably this is solved by some other tools, but I was annoyed by the fact that the .sidebar can leave the .container :smiley:

Ahh, i see. Nice catch. :+1:

1 Like