<div class="relative">
  <h1>My position is relative!</h1>
</div>
<div class="normal">
  <h1>My position is static!</h1>
</div>
<div class="relative">
  <h1>My position is relative!</h1>
</div>
<div class="normal">
  <h1>My position is static!</h1>
</div>
<div class="relative">
  <h1>My position is relative!</h1>
</div>
<div class="normal">
  <h1>My position is static!</h1>
</div>
<div class="relative">
  <h1>My position is relative!</h1>
</div>
<div class="normal">
  <h1>My position is static!</h1>
</div>
<div class="fixed">I once was broke but now I'm <strong>fixed</strong></div>
.fixed {
  position: fixed;
  background-color: yellow;
  font-size: 20px;
  width: 100%;
  left: 0;
  top: 50%;
}

.relative {
  background-color: Turquoise;
  position: relative;
  /* Offset properties */
  top: 20px;
  left: 30px;
}

.normal {
  background-color: Tomato;
}

body {
  font-family: roboto, sans-serif;
  padding: 50px;
}

div {
  width: 400px;
  margin: 0 auto;
  padding: 10px;
  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.