Utvikling · verktøy

HTML-, CSS- og JavaScript-lekeplass

Skriv HTML, CSS og JavaScript, og trykk deretter Kjør for å se en lokal forhåndsvisning.

Kjøres i nettleseren. Ingen opplasting.

Values are processed locally in this browser.

Result

—

Om verktøyet

HTML-, CSS- og JavaScript-lekeplass sem complicação.

Koden kjøres først når du trykker Kjør i en isolert iframe. Forhåndsvisningen har ikke tilgang til samme opprinnelse og kan ikke lese lagringen på denne siden.

Veiledning

Slik bruker du HTML-, CSS- og JavaScript-lekeplass

The HTML CSS JavaScript Playground lets you type a small page in three boxes and see it run in a preview frame on the same screen. You write the HTML, the CSS and the JavaScript, press the main button, and the code runs inside a sandboxed frame that is cut off from this page. It is for quick experiments, not for building or hosting a real project.

Slik gjør du

  1. Type your markup in the HTML box, your styles in the CSS box and your script in the JavaScript box. You do not need all three, and you do not need to write the html, head or body tags.
  2. Press the main button under the boxes. Its label reads Calculate, although the page text calls it Run. The code runs only after you press it, not while you type.
  3. Look at the preview frame in the Result area. It shows your page after the CSS was applied and the script ran.
  4. Edit the boxes and press the button again to refresh the preview. Clear empties the three boxes, so copy anything you want to keep first.

Eksempler

A heading, a style and a script

Du skriver inn
HTML
<h1 id="t">Hello</h1><p id="o">waiting</p>
CSS
h1{color:crimson}
JavaScript
alert("hi")
Du får
Forhåndsvisning
En karmosinrød overskrift med teksten «Hello», og den andre linjen viser «JS ran» i stedet for «waiting».

The CSS colors the heading crimson and the script replaces the text of the second line. This was run in the live page and the preview showed both changes.

Kjørt med verktøyets egen kode.

Storage and network are blocked

Du skriver inn
JavaScript
fetch("https://example.com"); localStorage.setItem("a","1")
Du får
Fetch
blocked
Lokal lagring
blocked

In a test run, both calls failed inside the frame. The frame has no same-origin access, and its content policy blocks all network requests. Your script cannot reach the page's storage or the web.

Kjørt med verktøyets egen kode.

A remote image does not load

Du skriver inn
HTML
<img src="https://example.com/x.png" alt="remote image">
JavaScript
alert("hi")
Du får
Bilde
shows only its alt text
Varsling
no pop-up appears, and the script carries on

The frame allows only images given as data: or blob: addresses, so a web address fails and the alt text shows. The alert call does not stop the script, and no dialog appears. This was tried in the live page.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Test how a few lines of CSS change a small block of HTML.
  • Try a short JavaScript idea that changes the page, such as updating text or toggling a class.
  • Show a beginner what a simple page looks like without setting up a project.
  • Reproduce a small layout problem in isolation before asking someone for help.

Begrensninger

  • The preview runs in a sandboxed frame that can run scripts but has no same-origin access. Your code cannot read this page's storage, cookies or data.
  • The frame cannot load anything from the web, whether scripts, styles, fonts, fetch calls or images. Only inline code and images given as data: or blob: addresses work.
  • Each box is cut off at 100,000 characters when the preview is built, and the sandbox blocks pop-up dialogs. The preview frame is small, and the page shows no console or error output.
  • The Clear button empties the boxes and the result line, but the preview frame keeps showing the last run. The Copy result button copies only the short status line, not your code.

Tips

  • Put your code in one place, such as a text file, before you press Clear, because the boxes are not saved.
  • Test small changes one at a time. With no error panel, a typo can make the preview simply look wrong.
  • Use inline CSS and a data: image if you need an image, since links to outside files will not load.

Kilder

Vanlige spørsmål

Sobre HTML-, CSS- og JavaScript-lekeplass.

How do I use the HTML CSS JS playground?

Write HTML, CSS and JavaScript in the three boxes, then press the main button. The code runs in a sandboxed preview frame under the boxes. Edit the code and press the button again to refresh the preview.

Is my code uploaded to a server?

No. The tool runs in your browser, and your input is not uploaded. The preview is built locally from the three boxes and shown in a frame on the same page.

Is it safe to run code I do not trust?

The frame is sandboxed. It has no same-origin access, cannot reach this page's storage, and its policy blocks network requests. Even so, do not paste code you do not understand, and do not type secrets into it.

Why does my external script, font or image not load?

The preview uses a strict content policy that blocks every outside address. Only inline styles, inline scripts and images given as data: or blob: addresses are allowed, so links to a CDN or another site will fail.

Why can't I see console.log output or errors?

The tool has no console panel and shows no error messages. If a script fails, the earlier changes it made can remain in the preview. Test small pieces to find a problem, or use your browser's own tools in another page.

Does it save my work?

No. The boxes are not stored, and Clear empties them. Copy your code to a file or a note elsewhere if you want to keep it.

Hvordan bruker du Lekeplass for HTML, CSS og JS?

Skriv HTML, CSS og JavaScript, og trykk deretter Kjør for å se en lokal forhåndsvisning.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.