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

+ 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.


                <!-- Example for HighlighJs Code Badge Component -->
<!-- -->

<!DOCTYPE html>
<html lang="en" xmlns="">
    <meta charset="utf-8">    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">    

    <link rel="stylesheet" href="" 
          integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <link href="" rel="stylesheet" 
          integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">     
        /* optionally override badge styling */
        .code-badge {
             background: #555 !important;
             padding: 8px !important;
        .code-badge-copy-icon {
            font-size: 1.3em !important;
<div class="container" style="margin-top: 20px;">
    <div class="float-right" >
    <a href="" target="_blank"><i class="fa fa-github"></i> repo</a></div>
    <h1>HighlightJS Badge Code Copying Sample </h1>
    <h3 class="mt-3">Single line code snippet</h3>
    <pre><code class="hljs language-js">let x = 1;</code></pre>

    <h3 class="mt-3">Larger code snippet</h3>
    <pre><code class="hljs lang-cs">public static string GetChecksumFromFile(string file)
    if (!File.Exists(file))
        return null;

        byte[] checkSum;
        using (FileStream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read))
            var md = new MD5CryptoServiceProvider();
            checkSum = md.ComputeHash(stream);

        return StringUtils.BinaryToBinHex(checkSum);
        return null;

<pre><code>Content-Type: text/html
Accept: application/json
Content-Length: 12332


<link href="" rel="stylesheet">
<script src=""></script>
<script src=""></script>
    setTimeout(function () {
        var pres = document.querySelectorAll("pre>code");
        for (var i = 0; i < pres.length; i++) {
        var options = {
            contentSelector: ".container",
            // Delay in ms used for `setTimeout` before badging is applied
            // Use if you need to time highlighting and badge application
            // since the badges need to be applied afterwards.
            // 0 - direct execution (ie. you handle timing

            // CSS class(es) used to render the copy icon.
            copyIconClass: "fa fa-copy",
            // CSS class(es) used to render the done icon.
            checkIconClass: "fa fa-check text-success",
            // hook to allow modifying the text before it's pasted
            onBeforeTextCopied: function(text, codeElement) {
              return text;   //  you can fix up the text here

<!-- optional customization template -->

<!-- Used in this demo  and styling can be adjusted here -->
    "@media print {
        .code-badge { display: none; }
    .code-badge-pre {
        position: relative; 
    .code-badge {
        display: flex;
        flex-direction: row;
        white-space: normal;
        background: transparent;
        background: #333;
        color: white;
        font-size: 0.8em;
        opacity: 0.5;
        border-radius: 0 0 0 7px;
        padding: 5px 8px 5px 8px;
        position: absolute;
        right: 0;
        top: 0;
    } {
        opacity: 0.8;
    .code-badge:hover {
        opacity: .95;
    .code-badge a,
    .code-badge a:hover {
        text-decoration: none;

    .code-badge-language {
        margin-right: 10px;
        font-weight: 600;
        color: goldenrod;
    .code-badge-copy-icon {
        font-size: 1.2em;
        cursor: pointer;
        padding: 0 7px;
    .fa.text-success:{ color: limegreen !important}    
<div id="CodeBadgeTemplate" style="display:none">
    <div class="code-badge">
        <div class="code-badge-language">{{language}}</div>
        <div title="Copy to clipboard">
            <i class="{{copyIconClass}} code-badge-copy-icon"></i>
<!-- end customization template -->