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


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 class="p-8">
  <div data-dropdown class="relative inline-block">
    <button data-dropdown-trigger>
      Hello, Sebastian 🔽
    <ul data-dropdown-list class="hidden absolute right-0 top-0 mt-8 bg-gray-100 rounded border shadow-lg overflow-hidden">
      <li><a href="#" class="block px-4 py-2 hover:bg-blue-400 hover:text-white">Profile</a></li>
      <li><a href="#" class="block px-4 py-2 hover:bg-blue-400 hover:text-white">Settings</a></li>
      <li><a href="#" class="block px-4 py-2 hover:bg-blue-400 hover:text-white">Log out</a></li>




                // Utilities

function $(selector, scope = document) {
  return scope.querySelector(selector);

function listen(type, selector, callback) {
  document.addEventListener(type, event => {
    const target =;
    if (target) {
      callback(event, target);

// Dropdown

listen('click', '[data-dropdown-trigger]', openDropdown);

function openDropdown(event, dropdownTrigger) {
  const dropdownList = $(

  if (!dropdownList.classList.contains('hidden')) {


  function handleClick(event) {
    if (!dropdownList.contains( {

      window.removeEventListener('click', handleClick);

  window.requestAnimationFrame(() => {
    window.addEventListener('click', handleClick);