Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
How to build your first interactive HTML5 canvas comes down to three pieces: an HTML <canvas> element, a JavaScript 2D rendering context, and event or animation code that changes what gets redrawn. The small project below creates a responsive 640×360 drawing surface, lets a pointer drag a colored circle, and animates that circle when you release it. It also keeps instructions, controls, and status text in ordinary HTML so the experience is not trapped inside a bitmap.
You need basic HTML and JavaScript, a modern browser, and a text editor. The MDN Canvas tutorial follows the same progression from a first shape to interaction, animation, and optimization.
As an Amazon Associate I earn from qualifying purchases.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →What is an HTML5 canvas, and why is it useful?
The <canvas> element is a bitmap drawing surface. It does not contain a tree of individually addressable shapes; JavaScript paints pixels into it through a rendering context. As MDN puts it, “The Canvas API provides a means for drawing graphics via JavaScript and the HTML <canvas> element.” You can use that model for a small game, a sketching tool, a chart, a particle effect, or any animation in which your program redraws the scene.
Start with the 2D context:
const canvas = document.querySelector("#stage");
const ctx = canvas.getContext("2d");
The context supplies methods such as fillRect(), arc(), fill(), stroke(), clearRect(), and fillText(). A canvas is a good fit when your program owns the pixels and can repaint the scene each frame. If you need separately selectable, resizable shapes with document-like semantics, SVG or normal HTML elements may be easier to manage.
Popular on Amazon
- 【90 Degree Full Function USB C Adapter】Supports the latest USB4 standard for up to 40Gbps of bandwidth, 8K video support, and up to 240W Fast charging; Support USB PD 3.1 Extended Power Range (EPR) including 140W, 180W and 240W. Your productivity is easily doubled. *Warm Tip: For the best fit, please make sure the USB-C port is fully exposed; thick or bulky cases may affect compatibility.
- 【Reliable Quality】Made from high-quality, scratch-resistant aluminum alloy, delicate metal frame. get excellent wear resistance and heat dissipation. Non-Slip Design for easier insertion and removal.
- 【Small and portable】Ultra thin size, ultra compact design, a petite physique that matches the minimalist design of your modern laptops. Coming with a slim figure that won't block the port next to the one it's plugged into.
- 【Compatibility】Widely work with most usb c, thunderbolt 4/3 devices. Compatibilit for ROG Ally, Steam Deck, Switch, MacBook Pro, Quest 3 VR headset, Surface Book 2, iPhone 18/17/16/15, Samsung Galaxy S23/S22/S21, Note 20/10, Google Pixel, ChromeBook, etc.
- 【Excellence Customer Support】If you experience any issues or cable failure, simply reach out to our dedicated customer service team. We provide a prompt response within 18 hours, providing you with the necessary technical support to resolve any concerns.
What do I need before I start?
Make a folder containing an index.html file and a script.js file. Open the HTML file in a browser as you work; no server or framework is required for this first example. You should be comfortable selecting an element with querySelector(), declaring variables, writing functions, and responding to DOM events.
Keep the first experiment deliberately small. A single moving object exposes the important decisions—internal dimensions, coordinate conversion, pointer input, an animation loop, and accessible controls—without burying you in a game engine or rendering abstraction.
How should I size the canvas?
Give the element explicit width and height attributes. An unspecified canvas starts with drawing dimensions of 300 by 150 pixels, according to the MDN <canvas> reference. Those attributes define the bitmap’s coordinate system; CSS controls how that bitmap is displayed.
For example, a 640×360 canvas has an internal point at (640, 360) even if CSS displays it at 320×180. If CSS changes the displayed width and height by different proportions, the image is stretched. Preserve the aspect ratio unless distortion is intentional.
<canvas id="stage" width="640" height="360">
Your browser cannot display this interactive graphic. The demo shows a circle that can be dragged with a pointer and moves when released.
</canvas>
The text between the opening and closing tags is fallback content. It is useful to people whose browser cannot render the canvas and gives assistive technology something meaningful to expose, but it does not turn the pixels themselves into semantic objects.
How do I create the first visible shape?
Put this complete page in index.html. The CSS makes the bitmap shrink to the available column while preserving its 16:9 ratio. The paragraph, buttons, and live status are deliberately outside the canvas.
Recommended Free Tools
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Interactive canvas demo</title>
<style>
body {
font: 1rem/1.5 system-ui, sans-serif;
max-width: 48rem;
margin: 2rem auto;
padding: 0 1rem;
}
canvas {
display: block;
width: 100%;
max-width: 640px;
height: auto;
border: 1px solid #555;
background: #101827;
touch-action: none;
}
.controls { display: flex; gap: .75rem; margin-top: .75rem; }
</style>
</head>
<body>
<h1>Drag the circle</h1>
<p id="canvas-help">
Drag the circle with a mouse, pen, or touch pointer. Release it to let it move.
Use the buttons below to pause or reset the animation.
</p>
<canvas id="stage" width="640" height="360" aria-describedby="canvas-help">
An interactive circle appears here. The controls and description below provide
the same essential instructions in HTML.
</canvas>
<div class="controls">
<button id="pause" type="button">Pause</button>
<button id="reset" type="button">Reset</button>
</div>
<p id="status" aria-live="polite">The circle is moving.</p>
<script src="script.js" defer></script>
</body>
</html>
At this stage the page contains a canvas but no drawing. The fallback sentence is not decoration: it is the useful explanation a non-canvas user receives. The aria-describedby relationship associates the explanatory paragraph with the canvas element, while the buttons remain normal, keyboard-operable HTML controls.
Now create script.js and verify the rendering path with a simple shape:
Also popular on Amazon
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
const canvas = document.querySelector("#stage");
const ctx = canvas.getContext("2d");
ctx.fillStyle = "#3b82f6";
ctx.fillRect(40, 40, 120, 80);
Reload the page. A blue rectangle at the upper-left confirms that the element was found, the 2D context was created, and drawing commands are reaching the bitmap. Remove this test code before adding the complete example below.
How do I convert a pointer position into canvas coordinates?
Pointer events report coordinates in the browser’s viewport. The canvas has its own internal coordinate system, so convert the event using the canvas’s bounding rectangle and scale each axis independently. This matters whenever CSS displays the bitmap at a size different from its internal width and height.
function pointerPosition(event) {
const rect = canvas.getBoundingClientRect();
const scaleX = canvas.width / rect.width;
const scaleY = canvas.height / rect.height;
return {
x: (event.clientX - rect.left) * scaleX,
y: (event.clientY - rect.top) * scaleY
};
}
clientX and clientY are measured from the viewport. Subtracting rect.left and rect.top moves the origin to the canvas’s visible top-left corner; multiplying by scaleX and scaleY maps the result to the bitmap. Do not assume that the two scales are equal unless you have deliberately locked the display and drawing ratios.
For input, use the Pointer Events model. MDN’s Pointer Events guide documents one event family for mouse, pen, and touch. That lets the same handlers serve several kinds of pointing hardware.
How do I add dragging with Pointer Events?
Track whether the pointer is being dragged, capture the pointer when it goes down, and stop dragging on release or cancellation. Pointer capture keeps subsequent movement associated with the canvas even if the pointer briefly leaves its bounds.
let dragging = false;
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
canvas.setPointerCapture(event.pointerId);
moveCircleToPointer(event);
});
canvas.addEventListener("pointermove", (event) => {
if (dragging) moveCircleToPointer(event);
});
function stopDragging(event) {
dragging = false;
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
function moveCircleToPointer(event) {
const point = pointerPosition(event);
state.x = Math.max(state.radius, Math.min(canvas.width - state.radius, point.x));
state.y = Math.max(state.radius, Math.min(canvas.height - state.radius, point.y));
}
The clamping keeps the circle’s center far enough from each edge that the circle remains visible. The touch-action: none rule in the example tells the browser that this surface owns the gesture; without it, a touch drag may be interpreted as page scrolling. Use that rule only on an area where taking over the gesture is the intended behavior.
How do I animate the object without tying it to a particular display refresh rate?
Use requestAnimationFrame() to schedule the next draw, and use elapsed time—not a fixed number of pixels per callback—to update position. MDN’s Canvas tutorial and drawing graphics guide cover this animation pattern. A callback receives a timestamp in milliseconds, so convert the difference to seconds before multiplying by a velocity expressed in pixels per second.
Here is the complete script.js for the page above:
const canvas = document.querySelector("#stage");
const ctx = canvas.getContext("2d");
const pauseButton = document.querySelector("#pause");
const resetButton = document.querySelector("#reset");
const status = document.querySelector("#status");
const initialState = {
x: 120,
y: canvas.height / 2,
radius: 24,
velocityX: 150,
color: "#f59e0b"
};
const state = { ...initialState };
let dragging = false;
let paused = false;
let previousTime;
function pointerPosition(event) {
const rect = canvas.getBoundingClientRect();
return {
x: (event.clientX - rect.left) * (canvas.width / rect.width),
y: (event.clientY - rect.top) * (canvas.height / rect.height)
};
}
function moveCircleToPointer(event) {
const point = pointerPosition(event);
state.x = Math.max(state.radius,
Math.min(canvas.width - state.radius, point.x));
state.y = Math.max(state.radius,
Math.min(canvas.height - state.radius, point.y));
state.color = "#22c55e";
status.textContent = "The circle is being dragged.";
}
canvas.addEventListener("pointerdown", (event) => {
dragging = true;
canvas.setPointerCapture(event.pointerId);
moveCircleToPointer(event);
});
canvas.addEventListener("pointermove", (event) => {
if (dragging) moveCircleToPointer(event);
});
function stopDragging(event) {
dragging = false;
state.color = "#f59e0b";
status.textContent = paused ? "The animation is paused." : "The circle is moving.";
if (canvas.hasPointerCapture(event.pointerId)) {
canvas.releasePointerCapture(event.pointerId);
}
}
canvas.addEventListener("pointerup", stopDragging);
canvas.addEventListener("pointercancel", stopDragging);
function draw(timeInSeconds) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "#101827";
ctx.fillRect(0, 0, canvas.width, canvas.height);
const pulse = Math.sin(timeInSeconds * 4) * 2;
ctx.beginPath();
ctx.arc(state.x, state.y, state.radius + pulse, 0, Math.PI * 2);
ctx.fillStyle = state.color;
ctx.fill();
ctx.fillStyle = "#e5e7eb";
ctx.font = "16px system-ui, sans-serif";
ctx.fillText("Drag me", 20, 30);
}
function frame(now) {
if (previousTime === undefined) previousTime = now;
const elapsedSeconds = Math.min((now - previousTime) / 1000, 0.1);
previousTime = now;
if (!paused && !dragging) {
state.x += state.velocityX * elapsedSeconds;
if (state.x + state.radius > canvas.width) {
state.x = canvas.width - state.radius;
state.velocityX *= -1;
}
if (state.x - state.radius < 0) {
state.x = state.radius;
state.velocityX *= -1;
}
}
draw(now / 1000);
if (!paused) requestAnimationFrame(frame);
}
pauseButton.addEventListener("click", () => {
paused = !paused;
pauseButton.textContent = paused ? "Resume" : "Pause";
status.textContent = paused ? "The animation is paused." : "The circle is moving.";
if (!paused) {
previousTime = undefined;
requestAnimationFrame(frame);
}
});
resetButton.addEventListener("click", () => {
Object.assign(state, initialState);
state.y = canvas.height / 2;
status.textContent = paused ? "The circle was reset; the animation is paused." : "The circle was reset.";
});
draw(0);
requestAnimationFrame(frame);
The animation updates horizontal position by velocityX × elapsedSeconds. The Math.min() guard limits a single unusually long gap, such as returning to a background tab, so the circle does not leap an unreasonable distance in one update. This is implementation guidance rather than a performance measurement.
Also popular on Amazon
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Each frame clears the old pixels and paints the background and circle again. Canvas does not retain a scene graph for you; if an object should move, redraw the pixels at its new position. Keep simulation state—position, velocity, color, and interaction flags—in JavaScript variables rather than trying to read it back from the bitmap.
What does each part of the example do?
- Internal coordinate system: The attributes
width="640"andheight="360"establish the drawing units used byarc(),fillRect(), and pointer conversion. - Display sizing:
width: 100%,max-width: 640px, andheight: autolet the canvas fit a narrow screen without changing its aspect ratio. - Rendering:
draw()clears and repaints the entire scene. It also adds a small radius pulse so you can see that the timestamp is being used for animation. - Input:
pointerdown,pointermove,pointerup, andpointercancelcover the drag lifecycle. Pointer capture prevents a release outside the element from leaving the program stuck in a dragging state. - Motion: When the circle is not being dragged, elapsed time advances its position. Boundary checks reverse the velocity at the left and right edges.
- Controls: Pause, resume, and reset are real HTML buttons. Their labels and the live status paragraph remain available to keyboard and assistive-technology users.
How can I make a canvas accessible?
A canvas bitmap does not expose the objects drawn inside it to accessibility tools in the way semantic HTML does. MDN’s Canvas API overview and the <canvas> reference recommend meaningful fallback content and keeping essential instructions and controls in normal HTML.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
For a decorative animation, a concise description may be enough. For an interactive chart, game, or editor, provide an equivalent information path: headings and explanatory text, labeled buttons, form controls, a status region, or a table of important values. If dragging changes a value, offer keyboard-operable controls that change the same value. Do not make a canvas-only gesture the sole way to complete an essential task.
Use accessible names and relationships deliberately. In the example, aria-describedby points to instructions, aria-live="polite" announces status changes without interrupting every action, and the buttons have visible text. The canvas itself is not pretending that its painted circle is a semantic button.
What are the most common canvas mistakes?
The drawing looks stretched
Check the element’s numeric width and height attributes and compare them with its CSS box. A CSS rule that changes width and height by different ratios distorts the bitmap. Preserve the original ratio, as the MDN element reference warns, or deliberately resize the internal bitmap and redraw whenever the layout changes.
The pointer is offset from the object
Do not use event.offsetX as a universal substitute for conversion. Use getBoundingClientRect(), subtract the rectangle’s top-left coordinates, and multiply by the separate horizontal and vertical scale factors. This handles a canvas that has been resized by CSS.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteThe object leaves a trail
Animation frames must erase the previous scene before painting the new one. Call clearRect(0, 0, canvas.width, canvas.height), repaint the background if you need one, and then draw the current objects.
The animation speeds up or slows down on different screens
Avoid “move five pixels every callback.” Callback frequency can vary, so calculate elapsed time from the timestamps supplied to requestAnimationFrame() and multiply by a velocity measured per second.
Also popular on Amazon
- Portable and powerful USB-C HUB: BENFEI USB Type-C HUB, with super-soft and knot-free silicone woven design cable, meets most mobile office needs. Compact, lightweight, stylish, and powerful portable USB C Hub equipped with 1 x HDMI port, 1 x 100W charging, and 3 x USB ports. 18-month warranty, 24-hour response, to ensure you feel at ease when using our product.
- Design centered on comfort and reliability: Thanks to BENFEI's end-to-end in-house cable production capability, in-house PCBA and assembly capability, using the industry's most advanced silicone woven design and process, 20cm cable in length, no knots, super-soft, the HUB is easy to use in all scenarios: laptop, tablet, stand etc. Super-soft, 25000+ life cycles, to meet your daily carrying and office needs.
- 100W Charging: Support up to 90W USB C pass-through charging via Type-C port to keep your laptop powered. 10W is reserved for other interface operations. No data and video function on the Type-C port.
- 4K HDMI Display: The HDMI port supports media display at resolutions up to 4K 30Hz, keeping every incredible moment detailed and ultra vivid. Please note that the C port of the Host device needs to support video output.
- Transfer Files in Seconds: Transfer files and from your laptop at speeds up to 10 Gbps with USB A 3.2 port. Extra 2 USB A 2.0 ports are perfectly for your keyboards and mouse.
Touch scrolling takes over the gesture
Apply touch-action: none to the interactive canvas when it should own the drag. Keep the instruction and an alternative HTML control outside the canvas, and avoid disabling page scrolling on a large surrounding region.
The page becomes unresponsive after a pointer leaves
Use pointer capture on pointerdown and handle both pointerup and pointercancel. Releasing the capture when the interaction ends prevents stale pointer state.
The circle jumps after resuming
Reset the stored timestamp when restarting the loop. Otherwise, the first resumed frame may treat the entire paused interval as elapsed simulation time. The example sets previousTime to undefined before requesting a new frame.
When should I choose Canvas instead of SVG or HTML?
Choose Canvas when the natural operation is repainting pixels: a small game, freehand drawing, particle animation, or a visual effect. The rendering model is compact because your program owns the frame, but you must maintain object state, hit testing, resizing, and accessible alternatives yourself.
SVG keeps shapes as addressable elements. That can make individual selection, resizing, styling, and semantics more straightforward for diagrams, icons, maps, and document-like graphics. HTML elements are often the simplest choice for controls, labels, and layout. A hybrid is common: Canvas for the visual field, HTML for the toolbar, instructions, values, and keyboard alternatives.
There is no requirement to commit to one technology for an entire page. Decide whether the reader needs pixels that are redrawn frequently or objects that remain individually meaningful in the document.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesHow can I extend this first project safely?
Change one dimension at a time so you can identify regressions:
- Add a second object. Store an array of objects, update each one with elapsed time, and draw them in a consistent order.
- Add hit testing. On pointer input, compare the pointer’s canvas coordinates with each object’s bounds or radius before starting a drag.
- Add a score or value. Display it in a normal HTML element and update its text whenever the canvas state changes.
- Add keyboard controls. Use labeled buttons or a focused HTML control to move the same state that pointer input changes.
- Pause work when it is not visible. Stop or reduce animation when the page is hidden, then reset the timestamp when restarting.
- Separate model and rendering. Keep positions, velocities, and interaction state in plain JavaScript objects; keep the drawing function concerned with pixels.
As scenes grow, follow the optimization guidance in the MDN tutorial. First make the coordinate system, interaction rules, and accessible HTML clear; only then consider reducing redraw work or adding more elaborate graphics.
Also popular on Amazon
- 【Read before You Buy】 Note: This adapter is USB 2.0 version and cannot transmit HDM, VGA, or other video signals. Nevertheless, they are fully capable of charging devices,duplicating files, and can be seamlessly integrated with USB-C earphones, wireless network adapters, and SD card adapters.
- 【Easy to Use and Safe】Thanks to modern manufacturing techniques, we've made these adapters sufficiently compact so that they can remain inserted in your device without noticeable protrusion or inconvenience. This means you don't have to constantly plug and unplug them, reducing the likelihood of wear and misalignment, and making them more convenient to carry around.
- 【Reliable Quality】Engineered for enhanced durability, durable aluminum alloy shell material,get excellent wear resistance and heat dissipation,the male USB C and female USB connectors & the male USB and female USB C connectors are designed to be plugged and unplugged up to 20000 times. Provides data transfer, device charging, memory space expansion, and additional computer peripherals.
- 【Think more for you】Do you need to connect a USB-C-enabled device to an odd device that only has USB-A ports? Then these USB-A male to USB-C female adapters are made for you.Simply insert the adapter into the USB-A port on the device, and you can instantly connect your USB-C device to the device that originally didn't have the correct connection port.
- 【Trusted xiwxi Quality and Service】As a responsible brand seller, you will receive xiwxi's 12-month Quality assurance and lifetime friendly customer service, you're not just buying a product,you're investing in peace of mind with all-round quality and exceptional customer service.
Where can I learn more?
MDN’s Canvas tutorial is the best current starting point for the API sequence used here: basic shapes, paths, images, animation, and optimization. Its Canvas API overview, element reference, and Pointer Events guide are useful when you need exact method behavior or input details.
For a longer, book-style treatment, Pearson’s sample for Core HTML5 Canvas: Graphics, Animation, and Game Development covers graphics, animation, and interaction. The sample is from an older publication, so use current MDN documentation for present-day API details and compatibility notes.
Free tools Windows power users keep installed
One-click scans. No signup required.
What should I remember from the first project?
Canvas is a bitmap, not a semantic document. Set its internal dimensions explicitly, map pointer coordinates through the displayed rectangle, redraw with requestAnimationFrame(), and base movement on elapsed time. Put explanations, essential controls, and alternative ways to operate the feature in HTML around the canvas. Those habits give you a small interactive graphic that is predictable to resize, usable with different pointer devices, and ready to grow into a larger project.
Frequently Asked Questions
Can a responsive canvas keep its image sharp when its layout changes?
CSS can change the displayed size without changing the bitmap’s internal dimensions, but enlarging a small bitmap can look soft. If your application needs a different drawing resolution after a resize, update the canvas dimensions and redraw all state; changing those attributes clears the existing pixels.
Can I use an HTML canvas with touch and pen input at the same time?
Yes. Pointer Events expose a common event model for mouse, pen, and touch, and each event includes a pointer identifier. Keep separate pointer state if your application must support multiple simultaneous contacts rather than assuming one active pointer.
How do I export the picture drawn on a canvas?
The browser can serialize a canvas bitmap with methods such as toDataURL() or toBlob(). Export after the relevant frame has been drawn, and remember that a canvas containing cross-origin images may be restricted from reading pixels unless the image is provided with the appropriate CORS permission.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Is a canvas suitable for a form or a dashboard full of labels?
Usually not by itself. Canvas is strongest for pixel-oriented scenes; ordinary HTML elements provide built-in text semantics, focus behavior, and form interaction. A hybrid layout can use canvas for the visualization while leaving labels, values, filters, and controls in HTML.

