Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

HTML

              
                # When you realize
## This is not
### Uncompiled Markdown
#### But actual HTML
##### With some really
###### Weird styles.

---

**So this content is basically both valid HTML and valid Markdown. Boom.**

---

This is a paragraph where we'll test inline styles: **this is a strong tag**, *this is an em tag*, `this is a code tag`, [this is a link](https://codepen.io).

---

```html
This is a code block
```

---

This is a first paragraph.

This is a second paragraph.  
With a line break.

---

![This is an image](http://placekitten.com/200/200)

---

> This is a quote.

---

* This
* Is 
* An 
* Unordered
* List

1. This
2. Is
3. An
4. Ordered
5. List

---

<!-- There is no Github Flavoured Markdown checkboxes on CodePen -->
<input type="checkbox" /> Unchecked checkbox
<input type="checkbox" checked /> Checked checkbox
              
            
!

CSS

              
                /**
 * Defines the strategy for `h1` and `h2`
 * Either `prefix` for `#` and `##`
 * or `underliner` for `===` and `---`
 * @type String
 */
$h1-h2-strategy: 'underline';

/**
 * Defines the emphasize strategy for `em` and `strong`
 * Either `*`  for `*...*` and `**...**`
 * or `_` for `_..._` and `__...__`
 * @type String
 */
$em-strong-strategy: '*';

/**
 * Ordered list strategy
 * Either `manual` for `1. 2. 3.`
 * or `automatic` for `1. 1. 1.`
 * @type String
 */
$ol-strategy: 'manual';

/**
 * Unordered list strategy
 * Either `*`, or `-` or `+`
 * @type String
 */
$ul-strategy: '*';

/**
 * Horizontal rules strategy
 * Either `-` for `---`
 * or `*` for `***`
 * @type String
 */
$hr-strategy: '-';

/**
 * Baseline
 * Defines global `line-height` and `margin`
 * @type Number
 */
$baseline: 1.5;

/**
 * Font styles
 * @type List
 * @requires $baseline
 */
$font-style: 16px/#{$baseline} Monaco, "DejaVu Sans Mono", "Lucida Console", monospace;

/**
 * Resetting everything
 * Since Markdown is nothing but text
 * We put the text cursor all over the place
 */
* {
  font-size: 16px;
  margin: 0;
  padding: 0;
  font-weight: normal;
  font-style: normal;
  cursor: text;
}

/**
 * Giving some nice looking IDE font styles
 * Padding is here to make it easier to read 
 * preventing content from hitting the edges
 */
body {
  padding: 1em;
  font: $font-style;
}

/**
 * Mandatory line breaks
 */
ul, ol, p, hr, pre, #{headings()} {
  margin: ($baseline * 1em) 0;
}

/**
 * Headings
 */
@if ($h1-h2-strategy == 'underline') {
  h1::after,
  h2::after {
    display: block;
  }
  
  h1::after { content: '==='; }
  h2::after { content: '---'; }
} @else {
  h1::before { content: '# '; }
  h2::before { content: '## '; }
}

h3::before { content: '### '; }
h4::before { content: '#### '; }
h5::before { content: '##### '; }
h6::before { content: '###### '; }

/**
 * Em tags
 */
em::before,
em::after { 
  content: quote($em-strong-strategy);
}

/**
 * Strong tags
 */
strong::before,
strong::after { 
  content: quote($em-strong-strategy + $em-strong-strategy);
}

/**
 * Code tags
 * Only add backticks
 * when code is not inside a pre
 */
code {
  font: $font-style;
}

:not(pre) > code::before,
:not(pre) > code::after {
  content: '`';
}

/**
 * Links
 * Resetting styles:
 * text-decoration, color
 */
a {
  color: inherit;
  text-decoration: none;

  &::before {
    content: '[';
  }

  &::after {
    content: '](' attr(href) ')';
  }
}

/**
 * Horizontal rules
 * Hiding the rule
 * then display three hyphens
 */
hr {
  border: none;

  &::before {
    content: quote($hr-strategy + $hr-strategy + $hr-strategy);
  }
}

/**
 * Code blocks
 * Could work with indent as well
 */
pre::before,
pre::after {
  content: '```';
  display: block;
}

/**
 * Ordered lists
 */
@if ($ol-strategy == 'automatic') {
  ol {
    list-style: none;
  
    li::before {
      content: '1. ';
    }
  }
} @else {
  ol {
    list-style-position: inside;
    list-style-type: decimal;
  }
}

/**
 * Unordered lists
 * 1. One space if supported, else `em`
 */
ul {
  list-style: none; 

  li::before { 
    content: quote($ul-strategy);
    margin-right: .5em; /* 1 */
    margin-right: 1ch; /* 1 */
  }
}

/**
 * Image tags
 * Weird hack to prevent the image from being displayed
 */
img {
  content: '';

  &::before {
    content: '![' attr(alt) '](' attr(src) ')';
  }
}

/**
 * Blockquote
 * Add a chevron to first item of blockquote
 * usually a paragraph
 */
blockquote :first-child::before {
  content: '> ';
}

/**
 * Checkbox
 * 1. Overrides UA styles
 */
input[type=checkbox] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  &:focus {
    outline: none;
  }
  
  &::before {
    content: '[ ]';
    font: $font-style; /* 1 */
  }
  
  &:checked::before {
    content: '[x]';
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console