← Back to Portfolio

JavaScript / Frontend Project

Live HTML / CSS / JavaScript Editor

A browser-based code playground with live output rendering

This project is a simple in-browser code editor that lets users write HTML, CSS, and JavaScript and immediately see the result in a live preview panel.

It was built as a lightweight frontend project to demonstrate DOM interaction, iframe-based rendering, and real-time feedback from user input.

Project Overview

The editor is split into three input panels for HTML, CSS, and JavaScript, alongside a live output iframe that updates as the user types.

The goal was to create a small interactive web tool that demonstrates how frontend code can be gathered, combined, and rendered dynamically in the browser.

This project is useful as a practical JavaScript example because it combines real-time input handling, DOM access, iframe rendering, and dynamic code injection into a single simple interface.

Key Features

  • Separate editing areas for HTML, CSS, and JavaScript
  • Live output preview inside an iframe
  • Updates automatically as the user types
  • Simple layout for experimenting with frontend code
  • Built using HTML, CSS, and vanilla JavaScript

How It Works

The page listens for input changes in each editor field. When the user types, the script reads the values from the HTML, CSS, and JavaScript text areas and rebuilds the preview inside the output iframe.

The HTML is inserted into the iframe body, the CSS is injected through a style block, and the JavaScript is evaluated inside the iframe window.

This allows the preview to respond immediately without a page refresh, which makes the editor useful for quick experimentation and learning.

Live Example

Below is the interactive editor itself.

Code Example

The core update loop is intentionally simple and shows how the editor rebuilds the live preview.

JavaScript update function
function updateEditor() {
    let htmlValue = document.getElementById("html-code").value;
    let cssValue = document.getElementById("css-code").value;
    let jsValue = document.getElementById("js-code").value;
    let outputValue = document.getElementById("editor-output");

    outputValue.contentDocument.body.innerHTML =
        htmlValue + "<style>" + cssValue + "</style>";

    outputValue.contentWindow.eval(jsValue);
}

What This Project Demonstrates

  • DOM interaction: Reading values from multiple inputs and updating the page dynamically.
  • Live rendering: Displaying combined HTML, CSS, and JavaScript output inside an iframe.
  • Frontend tooling concepts: Building a lightweight browser-based development utility.
  • Vanilla JavaScript fundamentals: Event handling, document access, and runtime updates.

Portfolio Navigation

Project Info

Project Live HTML / CSS / JavaScript Editor
Role Solo Developer
Type Frontend Utility / Web Tool
Technologies HTML, CSS, JavaScript
Focus DOM Manipulation, Live Preview, Frontend Interactivity
Status Playable Demo