<div class="position-fixed">fixedで固定</div>

<div class="block-red"></div>
<div class="block-blue"></div>
<div class="block-green"></div>
<div class="block-red"></div>
<div class="block-blue"></div>
<div class="block-green"></div>



  
  
.position-fixed {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100px;
  background-color: #5CC0EF;
  font-size: 32px;
  letter-spacing: 0.05em;
  color: white;
}

.block-red {
  width: 100%;
  height: 400px;
  background-color: red;
}

.block-blue {
  width: 100%;
  height: 400px;
  background-color: blue;
}

.block-green {
  width: 100%;
  height: 400px;
  background-color: green;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.