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.


  <h2>Using <code>getComputedStyle()</code> to get styles from a pseudo-element</code></h2>

  <div class="box">
    <p>Call me Ishmael. Some years ago—never mind how long precisely—having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation.</p>

  <p>The color of the <code>::first-line</code> pseudo-element is: <output></output></p>

  <p>Using <code>getComputedStyle()</code>, you can get styles from a pseudo-element in the same way as other elements, including <code>::first-line</code>, as demonstrated above.</p>



                * {
  box-sizing: border-box;

body {
  padding: 0 20px;
  line-height: 1.4;
  font-size: 1.3em;
  font-family: Helvetica, Arial, sans-serif;

main {
  max-width: 700px;
  margin: 0 auto;

code, output {
  color: firebrick;
  font-family: Consolas, monospace;
  word-wrap: break-word;

.box {
  border: solid 1px #ccc;
  padding: 0 10px;

.box p::first-line {
  color: #ff69b4;


                let p = document.querySelector('.box p'),
    op = document.querySelector('output');

op.innerHTML = window.getComputedStyle(p, '::first-line').color;