Alright, so today I’m gonna walk you through how I built a super simple web builder. Don’t expect anything fancy – this is more of a weekend project kind of thing, but it actually turned out pretty useful for quickly throwing together landing pages and stuff.

First things first, I had to decide what I actually wanted. I figured, at a minimum, I needed:
- A way to drag and drop basic elements (think text, images, buttons).
- A simple editor to change the text and image sources.
- A live preview of the page.
- The ability to export the whole thing as HTML/CSS.
So, I fired up my trusty VS Code and started with the HTML structure. Nothing too crazy here, just a basic layout with a sidebar for the elements and a main area for the preview/builder itself.
Next up was the drag-and-drop functionality. I went with HTML5’s built-in drag and drop API. It’s a bit clunky, but honestly, it gets the job done. I basically added draggable="true"
to the sidebar elements and then handled the dragstart
, dragover
, and drop
events on the main area. Getting this to work smoothly took a bit of fiddling, especially preventing the browser from trying to open the dragged element as a link.
Once I could drag and drop elements, I needed to make them editable. For text, I just used contenteditable="true"
. This is super easy, but you lose a lot of control over formatting. For images, I added a simple input field that pops up when you click on the image, letting you change the src
attribute.
To handle the live preview, I just used a basic iframe
. Whenever the content in the builder changes, I update the iframe
‘s content with the current HTML. It’s not the most performant solution, but for simple pages, it’s good enough.

Finally, the export functionality. This was surprisingly straightforward. I just grabbed the HTML from the builder area and downloaded it as an HTML file. For the CSS, I had a basic stylesheet that I included in the exported HTML. I know it’s simple, but the idea was to create something easy and fast.
I spent a few hours cleaning things up, adding some basic styling, and fixing some bugs. Honestly, the biggest challenge was making the drag-and-drop feel good. The default HTML5 API is a bit janky, so I had to add some custom styling and logic to make it feel more responsive.
And that’s pretty much it. It’s not a perfect web builder by any means, but it’s surprisingly useful for quickly prototyping landing pages or creating simple websites. I even used it to build a quick portfolio page for myself.
Lessons learned? HTML5 drag and drop is okay for simple things, but if you need something more robust, you’re probably better off using a dedicated library. Also, contenteditable
is great for quick edits, but it’s not ideal for complex text formatting. All in all, it was a fun and productive weekend project!