Make a Sticky Header or Sidebar with CSS
This Q&A shows how to add a sticky header or sidebar in WordPress with only CSS. It walks through finding your element selector and adding position: sticky rules in your theme or custom CSS. You’ll see how to set top offsets and z-index for a neat result.