HTML element (source code)

= HTML element
{c}

An <HTML element> is a structural component of an <HTML> document with a defined name, attributes and semantics. Paragraphs, headings and controls are examples. An <HTML tag> is source syntax that can identify the start or end of an element; the element itself is the object represented in the parsed <Document Object Model>.<HTML Standard by WHATWG>[Introduction, A quick introduction to HTML; Elements and HTML syntax, Tags]{ref}

In `<p>Hello <em>world</em>.</p>`, the paragraph contains an emphasis element as well as text. The word world is inside the emphasis element, while Hello and the final period are other text in the paragraph. These parent-child relationships make the structure useful for navigation, editing and matching <CSS selectors>.

Not every element is written with an explicit start/end pair. For example, the line-break element `br` is a void element and has no end tag in <HTML> syntax. Conversely, two source strings can produce equivalent document structure because parsing accounts for omitted tags and other specified rules. Counting written tags is therefore not a reliable substitute for inspecting elements.<HTML Standard by WHATWG>[The HTML syntax, Elements, void elements and optional tags]{ref}

An <HTML element>'s semantic role and its display are connected through browser behavior but remain different descriptions. A paragraph can wrap across several visual lines, and a <CSS property> can change its appearance without replacing the paragraph element. Choosing structural elements for their meaning allows the same content to remain intelligible under different styles.