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.


Auto Save

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.


    Geckos are a group of usually small, usually nocturnal lizards. They are
    found on every continent except
          data-tooltip="Geckos are a group of usually small, usually nocturnal lizards. They are
                        found on every continent except Australia."

    Many species of gecko have
    <span data-tooltip="Hi there!">adhesive</span> toe pads which enable
    them to climb walls and even windows.


                main {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5rem;
  font-size: 16px;
  padding: 5%;

[data-tooltip] {
  text-decoration: underline;
  cursor: help;

[role="tooltip"] {
  opacity: 0;
  position: absolute;
  width: auto;
  max-width: 20%;
  height: auto;
  min-height: 25px;
  line-height: 25px;
  font-size: 1rem;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border-radius: 5px;
  margin-top: 10px;
  padding: 10px 15px;
  transform: translateX(-50%);

[role="tooltip"].active {
  opacity: 1;
  transition: opacity 0.1s;

[role="tooltip"]::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid rgba(0, 0, 0, 0.7);
  position: absolute;
  margin-top: -20px;
  transform: translateX(-50%);
  left: 50%;



                const tooltips = document.querySelectorAll("[data-tooltip]");

const displayTooltip = (e) => {
  const trigger =;
  const tooltip = trigger.querySelector("[role=tooltip]");

  const { x, y, width, height } = trigger.getBoundingClientRect(); = `${Math.floor(x + width / 2)}px`; = `${Math.floor(y + height)}px`;


const hideTooltip = (e) => {
  const tooltip ="[role=tooltip]");

const DELAY = 300;
let tooltipTimer = null;

tooltips.forEach((trigger) => {
  let tooltip = document.createElement("div");

  tooltip.setAttribute("role", "tooltip");
  tooltip.setAttribute("inert", true);
  tooltip.textContent = trigger.dataset.tooltip;


  trigger.addEventListener("mouseenter", (e) => {

    tooltipTimer = setTimeout(() => {
    }, DELAY);

  trigger.addEventListener("mouseleave", (e) => {