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.


@import url('');
<div class="wrapper">
  <h1>NASA would really like it if you stared at the moon on Saturday night</h1>
  <div id="img"></div> 
  <p>Did you know that Sept. 26, 2020 is officially the date of the annual International Observe the Moon Night?</p>
To celebrate the occasion, NASA's latest "Image of the Day" drop highlighted a view of Earth's lone natural satellite as seen back in 1991. The dark areas of the moon's surface are basalt plains that formed from ancient volcanic eruptions.</p>


                body {
  background: #111;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #ccc;

h1 {
  font-family: 'Montserrat', sans-serif;
  color: rgba(225,225,225,0.8);

.wrapper {
  max-width: 700px;
  margin: 0 auto;
  padding: 5px 20px 20px;
  background: rgba(125,125,125,0.3);
  overflow: hidden;

img {
  max-width: 50%;
  height: auto;
  float: left;

  margin: 20px 0 0;

@media only screen and (min-width: 1000px) {
    margin: 40px 0 0;


                const mediaQuery = window.matchMedia("(min-width: 1000px)")

function myFunction(mediaQuery) {
  if (mediaQuery.matches) { 
    $("#img").html(`<img src="" />`);
  } else {
    $('#img > img').remove();