Code Runner: HTML, CSS, JS Panes and Sandbox Isolation

Open Tool Online Code Runner

Three panes, one document

HTML structure, CSS styling and JavaScript logic live in separate editors and are assembled into a complete document for the preview. That assembly sets precedence: CSS lands in a style tag in the head, JS runs at the end so it can reach rendered elements. The preview is an isolated frame, and the sandbox toggle blocks popups and navigation so experiments cannot hijack the page.

Steps

  1. Write in each pane, switching via the HTML, CSS and JS buttons.
  2. Auto-run re-renders after a pause; delay options are 0.3, 0.6, 1.2 seconds or manual.
  3. Choose light or dark preview background and check contrast.
  4. Enable console capture and keep sandbox isolation on.
  5. Run, export a single HTML file, copy the current pane, or reload an autosaved draft.

What the sandbox blocks

Blocked popups mean alert and confirm do nothing, so debug through console output or on-page text. Blocked navigation means location assignments stay put, which matters when testing routing. Stricter sandboxes also deny same-origin access, so scripts cannot read the parent page or local storage — protective for the tool, but it also means authenticated logic cannot be tested here.

Auto-run and cost

Debouncing runs once after typing stops; short delays feel responsive but heavy pages slow input. Code with big DOM builds, animations or timers belongs on manual mode, or every keystroke rebuilds the page. Timers and listeners are not cleaned up on re-render and accumulate, which shows up as ever-growing logs and animations speeding up.

Common problems

Scripts in the head without DOMContentLoaded grab null references. Inline styles outrank selectors, so colour changes that refuse to apply usually meet an inline style. Relative paths break because the preview base differs from the project. Nested template literals tangle quotes. And an exported single file carries no images or dependencies.

Where it fits:It validates a small component, tries a regex, reproduces a CSS layout bug and lets a colleague run a minimal example. It cannot host a real project without bundling, dependency management or a build step. Sensitive logic never belongs here — pasted keys and internal addresses are already exposed. And build-specific production issues need the real project.

⏫︎