🌍 Public
Viewing a saved revision (read-only)
17b2b6bc89cb42f0ad35b5bbd4459c07
HTML Element
This example demonstrates the creation of an HTML element on a web page using vanilla JavaScript. It shows the fundamental pattern of dynamically adding a div to the document body. The code uses the Document Object Model (DOM) API methods `document.getElementsByTagName` to locate the root `<html>` element and `document.createElement` with `appendChild` to insert a new element with the id `dogsb`. A self-contained `elementObject` constructor function encapsulates the logic, and inline CSS styles set the page’s text alignment and font size.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.