field guide
Every block you drag becomes three files.
DragWeb lets you build an web page by snapping blocks together — underneath, it's writing plain HTML, CSS and JavaScript. This guide walks through the three languages, styled the same way DragWeb styles its own block editor.
HTML
Tags & elements
HTML describes the structure of a page. You write it using tags — keywords wrapped in angle brackets. A tag usually comes in a pair: an opening tag and a closing tag, with content sitting in between. Together, an opening tag, its content, and its closing tag form one element.
name=Some tags never wrap content and don't need a closing tag at all — <img>, <input> and <br> are the common ones. A few frequently-used tags:
| Tag | What it's for | DragWeb equivalent |
|---|---|---|
div, section | Invisible containers that group other elements | A "Layout" widget from the palette |
p, h1–h6 | Paragraph text and headings | Text / Label widget |
button, input | Things the user can click or type into | Button / Input widget |
img | An image | Image widget |
ul, li | A list, and each item in it | List widget |
HTML
Parent, child & the DOM tree
Elements can sit inside other elements. Whatever tag an element is written between becomes its parent; the elements inside it are that parent's children. Elements that share the same direct parent are siblings. String enough of these nestings together and the whole page becomes a tree — the browser's internal copy of that tree is called the DOM (Document Object Model).
- body
- sectionparent of the card
- div class="card"a child of section, parent of h2 + p
- h2sibling of p below
- psibling of h2 above
- div class="card"a child of section, parent of h2 + p
- sectionparent of the card
HTML
class vs id
Tags describe what an element is. class and id are attributes that let you label a specific element, so CSS and JavaScript can find and style it.
id one-of-a-kind
An id must be unique on the page — only one element can ever have it. Use it to target one exact thing.
<button id="submitBtn">Save</button> /* CSS */ #submitBtn { background: blue; } // JavaScript document.getElementById('submitBtn')
class reusable label
A class can be reused on as many elements as you like, and one element can even carry several classes at once.
<button class="btn primary">Save</button> <button class="btn">Cancel</button> /* CSS — styles every .btn at once */ .btn { border-radius: 8px; }
CSS
CSS basics
CSS answers "how should it look?" — you select an element (usually by tag, class, or id) and hand it a list of property: value pairs. Every visible box on a page follows the same layout rule, called the box model: content, wrapped in padding, wrapped in a border, wrapped in margin.
Common properties
DragWeb's Property Panel exposes fields per widget — every one of them maps to a real CSS property that the Style block writes for you.
| Property Panel field | CSS property | Example value |
|---|---|---|
| background | background | #2196F3 |
| color | color | #FFFFFF |
| fontSize | font-size | 16px |
| padding / margin | padding / margin | 12px |
| borderRadius | border-radius | 8px |
| width / height | width / height | 200px, 100% |
| opacity | opacity | 0.8 |
| textAlign | text-align | center |
| zIndex | z-index | 10 |
JS
JavaScript basics
CSS makes a page look right; JavaScript makes it do things. Three ideas cover most of what you need to start:
Variables
let count = 0; const name = "Saqib";
A named box to store a value. let can change later; const can't.
Functions
function greet(name) { return "Hi " + name; }
A reusable block of steps you can run by name, as many times as you like.
Events
btn.addEventListener( 'click', () => { /* ... */ } );
"When this happens, run this." The heart of interactivity.
Stack a few blocks, get real code
This is the same shape as a stack in DragWeb's block editor: an event on top, a condition, then an action.
button1.addEventListener('click', () => {
if (counter < 10) {
label1.textContent = counter;
}
});
Interactive
Sketchware-to-Web Sandbox
Configure property blocks visually, just like in DragWeb's Style and Logic screens, and see the exact HTML, CSS, and JS generated in real time. Click the custom view to see animations and event listeners run!
Bridge
How it all becomes one export
Put HTML, CSS and JS together and you get DragWeb's export pipeline:
Widget tree
Nested JSON — tags, ids/classes, properties.
PageCodeGenerator
Walks the tree for HTML, CSS and JS.
HTML + CSS + JS
Standards-compliant source files.
ExportManager
One file, split files, or a ZIP.
Cheatsheet
HTML
- Nesting = the DOM tree
idunique,classreusable- Self-closing:
img,input,br
CSS
- margin → border → padding → content
- Select by tag,
.class,#id - Values need units:
px,%,em
JS
let/conststore valuesaddEventListener('click', fn)getElementById(id)grabs one element
DragWeb
- Widget tag → HTML tag
- Property Panel field → CSS property
- Block stack → JS function body