What are the differences between the CSS properties "position: sticky" and "position: fixed" in the context of creating a sticky menu in PHP?

When creating a sticky menu in PHP, the main difference between "position: sticky" and "position: fixed" is that "position: sticky" will stick the element within its container when the user scrolls, while "position: fixed" will stick the element to a specific position on the viewport regardless of scrolling.

<nav style="position: sticky; top: 0;">
  <!-- Your menu items here -->
</nav>