Pen Settings

HTML

CSS

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

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.

Behavior

Auto Save

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.

HTML

              
                
  <h1>== Stairway to heaven ==</h1>
  <div class="blog-post">  
    <h2 class="blog-title"></h2>
    <p class="blog-content"></p>
    <button class="load-blog">Load Blog</button>
  </div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap");

/**
 * Override library
 */
* {
  font-family: "Ubuntu", sans-serif !important;
}

html, body {
  background-color: #2c3e50;
  color: #FFF;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.blog-post {
  padding: 16px;
  width: 80%;
  height: calc(100vh - 180px);
  margin: auto;
  border: 1px solid #FFF;
  overflow-y: auto;
}

.load-blog {
  border: none;
  color: #151515;
  padding: 9px 16px;
  font-family: "Ubuntu", sans-serif !important;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 21px;
  display: inline-block;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(
    90deg,
    #98ff6c 0%,
    #91fe74 23.07%,
    #45f1d1 76.59%,
    #38efe1 99.97%
  );
}
              
            
!

JS

              
                let blogDOM = {
  title: document.querySelector('.blog-title'),
  content: document.querySelector('.blog-content')
}

let button = document.querySelector('.load-blog')

function changeDOM(response) {
  blogDOM.title.innerText = response.title
  blogDOM.content.innerText = response.body
}




button.addEventListener('click', function () {
  // load post with callback changeDOM
  
})

function loadPost (callback) {
  // Create request

  // get https://jsonplaceholder.typicode.com/posts/1

  // Add listener with callback (parse response)
  
  // send request
}


// response = {
//   title: "...",
//   body: "..."
// }
              
            
!
999px

Console