Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="en" dir="ltr">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta charset="utf-8">
    <title>Making Stuffs</title>
    <link rel="stylesheet" href="./assets/css/style.css">
    <script src="./assets/js/head-scripts.js" charset="utf-8" defer></script>
    <header id='intro'>
      <div class='intro-box'>
        <h1 id='welcome-text'>
        <span id='text-1'>
          My name is Paul.
        <span id='text-2'>
          And I like to make... 
        <p id='intro-text'>
    <main id='main'>
      <section id='about'>
      <section id='skills'>
      <section id='portfolio'>
      <section id='contact'>
    <footer id='footer'>



                :root {
  --ms-lighter: #FCFFFE;
  --ms-light: #DDFFF7;
  --ms-midLight: #93E1D8;
  --ms-mid: #FFA69E;
  --ms-midDark: #AA4465;
  --ms-dark: #861657;
  --ms-darker: #281F24;
* {
  box-sizing: border-box;
html {
  font-size: 62.5%;
  scroll-behavior: smooth;
  background-color: var(--ms-darker);
  font-family: sans-serif;
body {
  overflow: auto;
  margin: 0;
header {
  min-height: 100vh;
  min-width: 100vw;
  background-color: var(--ms-dark);
  overflow: auto;
header > .intro-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
header > .intro-box > h1 {
  font-size: 4rem;
  margin: 0;
  position: absolute;
  text-align: center;
  width: 100%;
header > .intro-box > p {
  font-size: 2rem;
  margin: 0;
#text-1, #text-2 {
  position: absolute;
  font-size: 4rem;
  display: none;



// Make some basic functions to save time.
const query = (elem) => {
  return document.querySelector(elem);
const queryAll = (elem) => {
  return document.querySelector(elem);
const createElem = (elem) => {
  return document.createElement(elem);
// Get the header element.
const header = query('header');
// Get our h1 element.
let h1 = query('h1');
// Get the intro text element
const intro = query('#intro-text');
const myNameIs = query('#text-1');
const andIMake = query('#text-2');

  To create a web animation in the new web animation javscript API it is required
  that you first make an object which corresponds to a CSS keyframes block. This
  means it will need to have the parameters you would pass to a CSS transform or

  It is essentially a matter of taking each stage of the keyframe - the 'from'
  'to' bit, and them putting each stages changed CSS into an element. You do not
  need to add the steps of change as javascript will work it out.

  This means if we pass a keyframe with three objects javascript will split it
  into three animations which will see the middle key activate half way through
  the animation and the first one at 0% while the last is at 100%. This is
  unless intstructed to do otherwise. You can specify the offset of each keyframe
  by providing an offset key value pair. For example, offset: 0.3 would mean
  the affects in that section would be applied at 30% completion regardless of
  the order which it was found by javascript. If you have less than two keyframes
  you will get an error.


  var aliceTumbling = [
    { transform: 'rotate(0) translate3D(-50%, -50%, 0)', color: '#000' },
    { color: '#431236', offset: 0.3},
    { transform: 'rotate(360deg) translate3D(-50%, -50%, 0)', color: '#000' }

  The next step is to create an object which houses the timing functions of the
  animation. This is read as AnimationEffectTimingProperties by the browser.


  var aliceTiming = {
    duration: 3000,
    iterations: Infinity

  Duration must be in milliseconds and javascript uses 'iterations' instead of
  CSS's 'interation-count'

  In order to apply the styles you simply need to appenf 'animate' on the element
  and pass your arguments as objects.


const fade = (a = 0, b = 1) => {
  return [
    { opacity: a },
    { opacity: b }
const glideX = (a = '-10000px', b = '0px') => {
  return [
    { transform: `translateX(${a})`, position: 'absolute' },
    { display: 'block', offset:0.1 },
    { transform: `translateX(${b})`, position: 'unset' }
const glideY = (a = '-10000px', b = '0px') => {
  return [
    { transform: `translateY(${a})`, position: 'absolute' },
    { display: 'block', offset:0.1 },
    { transform: `translateY(${b})`, position: 'unset' }
const animateSettings = (dur = 1500, it = 1, fill = 'forwards', ease = 'ease-in-out') => {
  return {
    duration: 1500,
    iterations: 1,
    fill: 'forwards',
    easing: 'ease-in-out'
const start = h1.animate( fade(), animateSettings() );
start.onfinish = () => { = 'block';
  const nameIn = myNameIs.animate( glideX(), animateSettings() );
  nameIn.onfinish = () => {
    const welcomeGo = h1.animate ( glideY( '0px', '10000px' ), animateSettings() );
    welcomeGo.onfinish = () => { = 'none';
      console.log('all done');