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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <script>
  function getCookie(name) {
    var value = "; " + document.cookie;
    var parts = value.split("; " + name + "=");
    if (parts.length == 2) return parts.pop().split(";").shift();
  }
  var userType = getCookie("blog"); // You can replace "blog" with whatever you want to name your user type cookie but make sure to match it to your 1st Party Cookie Variable in Google Tag Manager.
  // If your cookie isn't 'undefined' AND its value is either "true" or "yes"...
  if (typeof userType != 'undefined' && userType.match(/true|yes/g))
  // ...set the value to "yes". We're just setting it again to what it already is to be super safe.
  {
    document.cookie = "blog=yes; path=/";
  }
  // Now, if we've come this far, we know the user doesn't have "yes" or "true" meaning they aren't the userType we're concerned with. Well, then we need to check if they've just visited a page that would indicate they just became that user type. The following would set the cookie if the user viewed www.example.com/blog/, www.example.com/blog/blog-post-name/, etc.
  else if (location.pathname.indexOf("/blog/") == 0) {
    // Change their status to "yes" if the did indeed visit the indicative page.
    document.cookie = "blog=yes; path=/";
  }
  // If they aren't already the user type and they haven't visited the special page, then set their status to "no". 
  else document.cookie = "blog=no; path=/";
  //Note:  Once we set this up, all users will be set to "no" because the first two conditions in this text will fail. 
</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console