<div class="flex-row">
  <h1>Simple CSS Animations</h2>
</div>
<div class="flex-row">
  <h2>Fade In</h2>
</div>
<div class="flex-row">
  <h3 class="fade-in-1">Fade in <hl1>Once</hl1> for <hl2>Three Seconds<hl2></h3>
</div>
<div class="flex-row">
  <h3 class="fade-in-1-ease">Fade in Ease in <hl1>Twice</hl1> for <hl2>Three Seconds</hl2> with <hl3>One Second Delay</hl3></h3>
</div>
<div class="flex-row">
  <h2>Slide Up</h2>
</div>
<div class="flex-row">
  <h3 class="slide-up-1-ease">Slide up Ease in <hl1>Once</hl1> for <hl2>Three Seconds</hl2> with <hl3>Two Second Delay<hl3></h3>
</div>
/* General Styling */

body {
  font-size: 18px;
  font-family: 'Helvetica Neue', Helvetica, sans-serif;
  background-color: black;
  margin-top: 2rem;
}

h1, h2, h3, p {
  font-weight: normal;
  color: white;
}

hl1 {
  background-color: red;
}

hl2 {
  background-color: blue;
}

hl3 {
  background-color: green;
}

.flex-row {
  display: flex;
  justify-content: center;
}

/* End General Styling */

/**
 * Animation Code
 *
 * See more specs on MDN.
 * https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations
 *
 */

/* Fade in Once for Three Seconds */
.fade-in-1 {
  animation: 3s 1 fadeIn; /* Do the fade. */
}

/* Fade in Ease in Twice for Three Seconds with One Second Delay */
.fade-in-1-ease {
  opacity: 0; /* Be invisible first. */
  animation: 3s ease-in 1s 2 fadeIn; /* Do the fade. */
  /* This ensures that the item to be animated 
     is hidden at the beginning, then stays
     visible at the end (persists).*/
  animation-fill-mode: forwards;  
}

/* The fading in part. Reused above. */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide up Ease in Once for Three Seconds with Two Second Delay */
.slide-up-1-ease {
  opacity: 0; /* Be invisible first. */
  animation: 3s ease-in 2s 1 slideUp; /* Do the slide. */
  /* This ensures that the item to be animated 
     is hidden at the beginning, then stays
     visible at the end (persists).*/
  animation-fill-mode: forwards;  
}

/* The sliding up part. Reused above. */
@keyframes slideUp{
  0% {
    opacity:0;
    transform:  translate(0px,25px)  ;
  }
  100% {
    opacity:1;
    transform:  translate(0px,0px)  ;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.