Real-time compilation of HTML elements, attributes, and tree structure.
Try it: change <h2> to <h1> in the editor and watch both panels update.
HTML (HyperText Markup Language) is the standard language for creating web pages. It describes the structure of content using a system of tags and attributes. Every HTML document follows a tree hierarchy called the DOM (Document Object Model).
An HTML element typically consists of:
<tagname attr="value"></tagname><br>, <img>, <input> have no closing tag.Sectioning & Grouping:
| Element | Description | Attributes |
|---|---|---|
<div> | Generic block-level container (used for layout) | global |
<span> | Generic inline container (used for text styling) | global |
<header> | Introductory content / navigation | global |
<nav> | Section with navigation links | global |
<main> | Dominant content of the document | global |
<section> | Thematic grouping of content | global |
<footer> | Footer for its nearest sectioning ancestor | global |
| Element | Description | Example |
|---|---|---|
<h1>-<h6> | Headings (h1 = highest, h6 = lowest) | <h1>Title</h1> |
<p> | Paragraph | <p>Text</p> |
<a> | Hyperlink | <a href="url">link</a> |
<ul> / <ol> | Unordered / Ordered list | <ul><li>item</li></ul> |
<li> | List item | — |
<table> | Table container | border, cellpadding |
<tr> | Table row | — |
<th> / <td> | Table header / data cell | colspan, rowspan |
<img> | Embeds an image (void element) | src, alt, width, height |
<br> | Line break (void element) | — |
<strong> | Bold / strong importance | — |
<em> | Italic / emphasized text | — |
Character entities are used to display reserved characters (like <, >, &) that would otherwise be interpreted as HTML code. They start with & and end with ;.
There are three formats: named (<), decimal numeric (<), and hex numeric (<).
| Char | Named | Numeric | URL Encoded | Description |
|---|---|---|---|---|
| < | < | < | %3C | Less than (starts tags) |
| > | > | > | %3E | Greater than (ends tags) |
| & | & | & | %26 | Ampersand (starts entities) |
| " | " | " | %22 | Double quote (attribute values) |
| ' | ' | ' | %27 | Single quote / apostrophe |
|   | %C2%A0 | Non-breaking space | |
| © | © | © | %C2%A9 | Copyright symbol |
| ® | ® | ® | %C2%AE | Registered trademark |
| € | € | € | %E2%82%AC | Euro currency |
| → | → | → | — | Right arrow |
% followed by two hex digits representing the byte. For example, a space becomes %20. The JavaScript function encodeURIComponent() performs this encoding automatically.
Framesets (HTML 4 / deprecated in HTML5) divided the browser window into multiple independent sections, each loading a separate HTML document. The <frameset> element replaced <body>, and <frame> defined each region.
Modern HTML uses <iframe> (inline frame) to embed one HTML document inside another. Unlike framesets, iframes work within the <body> and are responsive by default.
| Feature | <frameset> (Legacy) | <iframe> (Modern) |
|---|---|---|
| Replaces <body>? | Yes — body must be omitted | No — works inside body |
| Deprecated? | Yes — not supported in HTML5 | No — fully supported |
| Responsive? | No — fixed pixel dimensions | Yes — can use CSS width/100% |
| Attributes | cols, rows | src, srcdoc, sandbox, loading |
Understanding the difference between these three is critical for building web applications that handle text correctly across languages:
The <meta charset="UTF-8"> declaration tells the browser to interpret the page as UTF-8. Without it, the browser may guess the encoding (often Western/ASCII), which breaks special characters, emojis, and non-Latin scripts. Always include <meta charset="UTF-8"> in the <head>.
You can include any Unicode character directly in your HTML if the file is saved as UTF-8:
<p>日本語, हिन्दी, ελλάδα, 😀 are all valid in UTF-8</p>
Use character entities only for characters that have special meaning in HTML: < (<), > (>), & (&), " ("). Everything else is better as the literal character.