HTML, short for HyperText Markup Language, is the document language used to structure web pages and applications. An HTML element expresses a role such as a paragraph, heading or emphasized passage. An HTML attribute supplies additional information about an element. A web browser parses the source into a Document Object Model that represents the resulting document structure.[ref]
HTML Standard by WHATWG. Introduction, A quick introduction to HTML, elements, attributes and the document tree
Consider
<p class="warning">Save <em>your work</em>.</p>. The p element contains text and an em element; class="warning" is an attribute on the paragraph. The two elements form a nested structure. A CSS selector such as .warning can match that paragraph, while a CSS declaration chooses a presentation such as a red foreground color.This distinction preserves useful meaning across presentations. A heading or emphasized passage remains structurally identified even if a CSS rule changes its size, color or typeface. The browser's default styling is one rendering of that structure, not the definition of its semantics.[ref]
HTML Standard by WHATWG. Introduction, Presentational markup and the quick HTML example
The serialized source and the live document also need not stay identical after parsing or later changes. In particular, writing text that looks like a start tag inside a quoted source-code example is different from creating an element in the parsed tree. The HTML parser has specified error recovery for malformed input, but that recovery does not make every apparent nesting in a source file a valid document structure.[ref]
Articles by others on the same topic
Examples:
- html/min.html: minimal valid HTML document. It is insane however.
- html/min-sane.html: minimal sane HTML document. There are smaller valid ones, but they are insane.
- html/img.html
- html/img-broken.html: stackoverflow.com/questions/22051573/how-to-hide-image-broken-icon-using-only-css-html
- html/img-load-lazy.html: stackoverflow.com/questions/2321907/how-do-you-make-images-load-lazily-only-when-they-are-in-the-viewport/57389607#57389607
- html/iframe.html. Uses: html/iframe2.html, html/hello.txt and html/hello
- forms
- YouTube embeds