A developer wants a sidebar to be fixed on the desktop but static on mobile devices. Which CSS properties and values will they need to adjust using media queries?

  • position: absolute, right: 0;
  • position: fixed, left: 0, top: 0;
  • position: static;
  • position: sticky, top: 0;
When dealing with a sidebar that needs to be fixed on desktop and static on mobile, the appropriate approach is using position: sticky with a value of top: 0 within a media query. This ensures the sidebar remains fixed on desktop but becomes static on mobile.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *