Home / CSS Tips Generated By ChatGPT / Creating a Sticky Header in CSS Keep the header fixed at the top of the viewport during scrolling. Source Code .sticky-header { position: sticky; top: 0; background-color: #ccc; padding: 10px 0; z-index: 1000; }