Conform container size to centered grid content

Hello! In this Codepen I have a grid of items that uses auto-fit to keep them centered within a container (using margin-inline: auto). I also have a navbar using that same container class. Is there a way that I can keep the width of the navbar consistent with the main content as the page resizes? I've attached a mock-up image of the desired effect - note how the edge of each container matches.
image.png
Was this page helpful?