Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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.


                <div id="postWrap"></div>


                @import url('[email protected];700&display=swap');
body {
    font-family:'Montserrat', sans-serif;

#postWrap {
    width: 90%;
    border: 3px double #aaa;
    padding: 10px;
    margin: auto;
.error {
    color: #f00;
    text-align: center;
    font-weight: bold;


                function randomNum(x) {
    return Math.round(Math.random() * x);
const posts = [{
    title: '1. About Lorem ipsum',
    body: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio corporis veritatis unde libero nesciunt esse? Consectetur nostrum suscipit quae pariatur porro aut! Iure, aperiam at.'
}, {
    title: '2.How to use Lorem ipsum?',
    body: 'Consequatur delectus sint, accusantium assumenda quaerat dicta temporibus aut ex qui, possimus vitae. Sit vero tempore aspernatur possimus dolorum qui expedita saepe ab. Assumenda, dolore?'

function showPosts() {

    setTimeout(() => {
        let output = '';
        posts.forEach((post, index) => {
            output += `<h3>${post.title}</h3>
<a href="#">Read More</a>`;
        postWrap.innerHTML = output;
    }, 1000)

function createPost(post) {
    return new Promise((resolve, reject) => {
        setTimeout(() => {

            const error = randomNum(1);
            if (!error) resolve();
            else reject("Sorry, an error has occurred. Post not added");
        }, 2000)

        title: '3.What wrong with Lorem ipsum?',
        body: 'Eius nulla unde recusandae pariatur incidunt amet ducimus tempora eaque vero tempore quod fugiat corporis, in, excepturi eum vel, adipisci modi architecto. Possimus, ullam voluptatum.'
    .catch(err => postWrap.innerHTML += `<p class="error">${err}</p>`);