Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

Behavior

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                <html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
<div id="main" class="list-type">
  <h2>Multiplayer Friends List</h2>
  <ul id="list">
    <li>Marry</li>
    <li>Joey</li>
    <li>Bob</li>
  </ul>
</div>
<img src="https://cdn.pbrd.co/images/HmkFb8G.png" alt="">
<script src="async-await.js"></script>
</body>
</html>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Exo');

h2{
  color: #ff7b0d;
}

.list-type{
  width:410px;
  margin:0 auto;
}
.list-type ul {
  list-style:none;
}
.list-type ul li  {
  font-size:20px;
  font-family: 'Exo', sans-serif;
  vertical-align: middle;
  display: block;
  width: 390px;
  margin-left: -40px;
  height: 26px;
  background-color: rgba(38,38,38,1);
  border-left: 10px solid #E38D27;
  padding-left: 5px;
  padding-top: 5px;
  padding-bottom: 5px;
  text-decoration: none;
  color:rgba(255,255,255,1.000);
  margin-bottom: 7px;
  transition: all .2s ease-in-out;
}
.list-type ul li:hover {
  transform:rotate(-5deg);
  box-shadow:10px 10px 20px #000000;
}
button {
  color: #fff;
  padding: 5px 19px 10px 20px;
  background-color: rgba(38,38,38,1);
  margin: 0 auto;
  display: block;
  font-weight: 700;
  background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffa84c), color-stop(100%, #ff7b0d));
  background-image: linear-gradient(top, #ffa84c, #ff7b0d);
  border-radius: 28px;
  border-color: black;
  box-shadow: inset 0 1px 0 0 #FFC68E;
  font-size:22px;
  font-family: 'Exo', sans-serif;
  line-height: 1;
  padding: 7px 0 8px 0;
  text-align: center;
  text-shadow: 0 -1px 0 #FC5800;
  width: 410px; }
  button:hover {
    cursor: pointer;
 }
  button:active {
    border: 1px solid #ff7b0d;
    border-bottom: 1px solid #FC5800;
    box-shadow: inset 0 0 4px 4px black, 0 1px 0 0 #eeeeee; }

img{
  position: absolute;
  top: 20px;
  left: 1006px;
  width:30px;
  height: 30px;;
}
              
            
!

JS

              
                let friendsToInvite = ["John", "Ema", "Steven", "Hans", "Kiana"];

async function inviteFriends(array) {
  let list = document.getElementById("list");
  await Promise.all(array.map(async (item) => {
    await (item);
    let friend = document.createElement('li');
    friend.appendChild(document.createTextNode(item));
    list.appendChild(friend);
    return list;
  }))
}

let button = document.createElement('button');
button.textContent = "Invite all in-game friends";
button.onclick = function () {
  document.getElementById('main').appendChild(inviteFriends(friendsToInvite));
};
document.body.appendChild(button);

              
            
!
999px
Promise you'll await for me.

Console