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

              
                <head>
  <base target="_blank">
</head>

<main>
  <section class="intro">
    <h1>The <code>base</code> Element</h1>
    <p>All your base are belong to us</p>
  </section>
  <pre><code>&lt;head&gt;
   &lt;base target="_blank"&gt;
 &lt;/head&gt;</code>
  </pre>
  <section>
    <p>You can set conditions for all links in the document, by stating them in <code>base</code>. In this example, I'm putting <code>target="_blank"</code> in <code>base</code>. Now all links will open in a new tab. Neat!</p>
    <p>You can also make all links point the same URL, I could have done <code>base href="https://some-url-here"</code> as well.</p>
    <p>One small tip: <code>base</code> shouldn't have a closing tag. 🤷🏻‍♀️</p>
    <p>More info <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base">here ></a></p>
  </section>
  <section class="links">
    <p>
      <a href="https://css-tricks.com/">This link will now be opened in a new tab.</a>
    </p>
    <p>
     <a href="https://sarah.dev/">This one too!</a>
    </p>
  </section>
</main>
              
            
!

CSS

              
                body {
  font-family: "Muli", sans-serif;
  display: flex;
  justify-content: center;
  line-height: 1.4;
  background: #0e273c;
  color: #e8d7f1;
}

a,
a:visited,
a:active {
  color: #f1a7da;
  font-weight: bold;
}

main {
  margin: 0 17vw;
  max-width: 700px;
  display: flex;
  justify-content: center;
  align-content: center;
  align-items: center;
  flex-direction: column;
}

.intro {
  text-align: center;
  p {
    margin-top: -20px;
    font-style: italic;
    color: #a167a5;
  }
}

section {
  margin-top: 30px;
}

code {
  color: #d3bccc;
  padding: 2px 7px;
  background: #031727;
  border-radius: 3px;
  border: 1px solid #4c4a947d;
}

pre {
  border: 1px solid #4c4a947d;
  background: #031727;
  padding: 15px 20px 0 15px;
  code {
    border: none;
  }
}

.links {
  margin-bottom: 60px;
}

              
            
!

JS

              
                
              
            
!
999px

Console