<header class="site-header">
  <h1>I stay at the top of the page</h1>
</header>
.site-header{
  background: #111;
  color: #fff;
  padding: 0.5rem;
}
body{
  height: 2000px;
  margin: 0;
  background: linear-gradient(orange, red);
}

.site-header h1{
  font-family: arial, helvetica, serif;
  font-size: 1rem;
  margin: 0;
  text-align: center;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.