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.


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.





                body {
  background-color: #a3d5d3;


                document.addEventListener('DOMContentLoaded', init )

function init() {

const poem = ["When I heard the learn’d astronomer,","When the proofs, the figures, were ranged in columns before me, " , "When I was shown the charts and diagrams, to add, divide, and measure them, " ,
"When I sitting heard the astronomer where he lectured with much applause in the lecture-room, " , 
"How soon unaccountable I became tired and sick, " , 
"Till rising and gliding out I wander’d off by myself, " , 
"In the mystical moist night-air, and from time to time, " , 
"Look’d up in perfect silence at the stars."]
const main = document.querySelector('main')

function showPoem() {
  let h1 = document.createElement('h1')

  h1.innerText = "When I Heard the Learn'd Astronomer"

  let h2 = document.createElement('h2')

  h2.innerText = "by Walt Whitman "

  const poemDiv = document.createElement('div') = "astronomer"

  main.append(h1, h2, poemDiv)
  poem.forEach(line => {
    let p = document.createElement('p')
    p.innerText = line