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.


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.


<div id="code">
  def get_encoding_from_headers(headers):
    """Returns encodings from given HTTP Header Dict.
    :param headers: dictionary to extract encoding from.
    :rtype: str

    content_type = headers.get('content-type')

    if not content_type:
        return None

    content_type, params = _parse_content_type_header(content_type)

    if 'charset' in params:
        return params['charset'].strip("'\"")

    if 'text' in content_type:
        return 'ISO-8859-1'

    if 'application/json' in content_type:
        # Assume UTF-8 based on RFC 4627: since the charset was unset
        return 'utf-8'


                body {
  font-family: system-ui;
  background: #f06d06;

#code {
  white-space: pre; /* So the code won't wrap */
  width: 600px;
  height: 300px;
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  overflow-y: auto;
  visibility: hidden;

/* Hiding the scrollbars */

/* Chrome, Safari and Opera */
#code::-webkit-scrollbar {
    display: none;
#code {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */

/* Blinking cursor */
    content: "|";
    animation: blink 500ms linear infinite alternate;

@-webkit-keyframes blink{
    0%{opacity: 0;}
    100%{opacity: 1;}

@-moz-keyframes blink{
    0%{opacity: 0;}
    100%{opacity: 1;}

@keyframes blink{
    0%{opacity: 0;}
    100%{opacity: 1;}



                var target = document.getElementById('code');

// Highlight the code

// Get all the child nodes
var children = Object.values(document.getElementById('code').childNodes);

// Empty the target
target.innerText = '';

// And start the animation from the first node

function type(i) {
    // Little helper
    function randomNumber(min, max) {
        return Math.floor(Math.random() * (max - min) + min);

    // Make the content visible
    if (i === 0) { = 'visible';

    // When we've displayed all the nodes
    // Just start over
    if (i >= children.length) {
        i = 0;
        target.innerText = '';

    // Append each node to the target code placeholder
    // And scroll that div if the code scrolls past it
    if (children.hasOwnProperty(i)) {

        target.scrollTop = target.scrollHeight;

    // Step to the next node

    // Repeat the process
    // after a variable amount of time
    setTimeout(function () {
    }, randomNumber(200, 500));

// You made it this far, yay
// see it in action in my site