The Very First Rule of Life
If there’s a microphone anywhere near you, assume it’s hot and sending whatever you’re saying to the world. Seriously.
_..._
### Form submission with GET method Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Example form using the GET method. When submitted, the user agent loads the action URL with query parameters appended. ```html
``` -------------------------------- ### Correct alternatives to non-conforming br examples Source: https://www.w3.org/TR/2016/WD-html51-20160310/textlevel-semantics.html Correct alternatives to the previous non-conforming examples, using separate paragraphs instead of br. ```html ``` ```html ``` -------------------------------- ### Example of using the base element Source: https://www.w3.org/TR/2016/WD-html51-20160310/document-metadata.html An HTML example showing how to set the document base URL with the base element. The link to 'archives.html' resolves to 'http://www.example.com/news/archives.html'. ```htmlVisit the archives.
``` -------------------------------- ### Example of script nesting in HTML parsing Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html Illustrates how the tree construction stage handles a 'p' start tag token while processing a 'script' end tag token, demonstrating the reentrant parsing model. ```html ... ... ``` -------------------------------- ### HTML example with omitted tags Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html This example shows the document after omitting the html, head, and body start and end tags, resulting in a minimal but equivalent markup. ```htmlWelcome to this example.
``` -------------------------------- ### Table with all optional tags present Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html A complete HTML table with all start and end tags explicitly written. This serves as the baseline example before omitting optional tags. ```html| Function | Control Unit | Central Station |
|---|---|---|
| Headlights | ✔ | ✔ |
| Interior Lights | ✔ | ✔ |
| Electric locomotive operating sounds | ✔ | ✔ |
| Engineer’s cab lighting | ✔ | |
| Station Announcements - Swiss | ✔ |
This smells of lemons!
``` -------------------------------- ### Example: Grouping options with optgroup in a select element Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Shows how to offer a set of lessons from three courses in a select drop-down widget using optgroup elements to label each course. The form uses the GET method and includes a submit button. ```html ``` -------------------------------- ### Dialog system with fixed character lines Source: https://www.w3.org/TR/2016/WD-html51-20160310/common-idioms-without-dedicated-elements.html Example of a game FAQ/walkthrough listing known possible responses for each character, using sections, headings, and lists. The example shows ordered and unordered lists for different characters and scenarios. ```htmlSome characters repeat their lines in order each time you interact with them, others randomly pick from amongst their lines. Those who respond in order have numbered entries in the lists below.
Before the accident:
After the accident:
During the first clan meeting:
After the earthquake:
If there’s a microphone anywhere near you, assume it’s hot and sending whatever you’re saying to the world. Seriously.
_..._
| aaa |
Welcome to this example.
``` -------------------------------- ### Numeric input control example (type=number) Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Example of an input element with type=number, min=0, step=0.01, and name=price, used to collect a monetary amount. The step value allows two decimal places. ```html ``` -------------------------------- ### media.play() Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Starts playback of the media resource. Sets the paused attribute to false, loading the media resource and beginning playback if necessary. If playback had ended, it will restart from the start. ```APIDOC ## media.play() ### Description Starts playback of the media resource. Sets the paused attribute to false, loading the media resource and beginning playback if necessary. If playback had ended, it will restart from the start. ### Method play() ### Parameters None. ### Return Value None. ### Example ```js media.play(); ``` ``` -------------------------------- ### URL input with datalist example Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Example markup for an input element in the URL state with a datalist providing suggested URLs. The user agent may use session history to offer additional matches, which are not exposed to the DOM. ```html ``` -------------------------------- ### HTML example with white space added back Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html This example shows the same minimal markup with some white space added back for readability, which is still equivalent to the original document. ```htmlWelcome to this example.
``` -------------------------------- ### Dialog box example with form for adding coins Source: https://www.w3.org/TR/2016/WD-html51-20160310/interactive-elements.html An HTML example of a dialog element containing a form to add coins to a wallet. It uses the main element to highlight important content and includes input fields for amount and rounding. ```html ``` -------------------------------- ### Multipart form data entity body example Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Example of the entity body sent when submitting the POST form with multipart/form-data. Shows the multipart boundaries and field values. ```text ------kYFrd4jNJEgCervEContent-Disposition: form-data; name="t" cats ------kYFrd4jNJEgCervE Content-Disposition: form-data; name="q" fur ------kYFrd4jNJEgCervE-- ``` -------------------------------- ### Conforming p element examples Source: https://www.w3.org/TR/2016/WD-html51-20160310/grouping-content.html Three separate examples of conforming HTML fragments using the p element: a simple paragraph, a fieldset with paragraphs containing form controls, and a limerick with line breaks. ```htmlThe little kitten gently seated itself on a piece of carpet. Later in his life, this would be referred to as the time the cat sat on the mat.
``` ```html ``` ```htmlThere was once an example from Femley,
Whose markup was of dubious quality.
The validator complained,
So the author was pained,
To move the error from the markup to the rhyming.
Welcome! This is home of...
The Lockheed Martin multirole jet fighter aircraft! This page discusses the F-16 Fighting Falcon’s innermost secrets.
If there’s a microphone anywhere near you, assume it’s hot and sending whatever you’re saying to the world. Seriously.
_..._
Yeah! Especially when talking about your lobbyist friends!
Hey, you have the same first name as me.
This is the second.
Part of the MovieInfo™ Database
Drop an image here to have it displayed.
Welcome to this example.
``` -------------------------------- ### selectionStart attribute Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Gets or sets the offset to the character immediately following the start of the selection. Setting acts as if setSelectionRange() was called. ```APIDOC ## selectionStart attribute ### Description Gets or sets the offset (in logical order) to the character immediately following the start of the selection. If there is no selection, returns the offset to the character immediately following the text entry cursor. ### Method selectionStart (getter/setter) ### Parameters - **newValue** (number) - Required - The new start offset. ### Behavior - On getting: returns the offset to the character immediately following the start of the selection, or the cursor position if no selection. - On setting: acts as if `setSelectionRange()` was called with the new value as first argument, the current `selectionEnd` (or new value if `selectionEnd` is less) as second argument, and current `selectionDirection` as third argument. ``` -------------------------------- ### Use a plugin with fallback content (Flash video example) Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Shows how to embed a Flash plugin to play a video, with fallback to a video element and a link for browsers without Flash or video support. The object element uses type="application/x-shockwave-flash" and param elements for configuration. ```htmlLook at my video:
``` -------------------------------- ### TimeRanges interface Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html The TimeRanges interface represents a list of time ranges. It provides methods to get the start and end times of ranges by index. ```APIDOC ## TimeRanges interface ### Description The TimeRanges interface represents a list of ranges (periods) of time. It provides read-only access to the number of ranges and methods to retrieve the start and end times of each range. ### Interface Definition ``` interface TimeRanges { readonly attribute unsigned long length; double start(unsigned long index); double end(unsigned long index); }; ``` ### Attributes - **length** (unsigned long) - Read-only. Returns the number of ranges in the object. ### Methods #### start(index) - **index** (unsigned long) - Required. The index of the range. - Returns the time for the start of the range with the given index, in seconds. - Throws an `IndexSizeError` exception if the index is out of range (greater than or equal to the number of ranges). #### end(index) - **index** (unsigned long) - Required. The index of the range. - Returns the time for the end of the range with the given index, in seconds. - Throws an `IndexSizeError` exception if the index is out of range (greater than or equal to the number of ranges). ### Behavior - The `length` attribute must return the number of ranges represented by the object. - The `start(index)` method must return the position of the start of the indexth range, in seconds measured from the start of the timeline. - The `end(index)` method must return the position of the end of the indexth range, in seconds measured from the start of the timeline. - These methods must throw `IndexSizeError` exceptions if called with an index argument greater than or equal to the number of ranges. - Ranges in a `TimeRanges` object must be inclusive. - A normalized `TimeRanges` object has ranges that are ordered, don’t overlap, and don’t touch (adjacent ranges are folded into one bigger range). ``` -------------------------------- ### Pass a parameter to a plugin using param (O3D example) Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Complete HTML document showing how to use the param element to pass a parameter (o3d_features) to the O3D plugin. Includes fallback content (img and text) and a script reference. ```html``` -------------------------------- ### HTML example with white space preventing tag omission Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html This example shows a basic HTML document with white space around the head and body start tags, which prevents those tags from being omitted. The body and html end tags could be omitted without affecting the parse tree. ```html ** **** **
Welcome to this example.
``` -------------------------------- ### HTML comment syntax example Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html Shows the required syntax for HTML comments: start with . ```html ``` -------------------------------- ### Example of a select element with options Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Shows a select element with a label and five options, with the third option preselected using the selected attribute. ```html``` -------------------------------- ### hCalendar microformat example using time element Source: https://www.w3.org/TR/2016/WD-html51-20160310/textlevel-semantics.html Shows a hypothetical way of encoding an event using a variant on hCalendar that uses the time element for event start and end dates. ```html ``` -------------------------------- ### Flight booking example with datetime-local input Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Shows a fieldset with an airport selection and a departure time input using type=datetime-local with step=3600, plus a datalist of airports. ```html ``` -------------------------------- ### window.open() Source: https://www.w3.org/TR/2016/WD-html51-20160310/browsers.html Opens or navigates a browsing context by name, optionally creating a new auxiliary browsing context. Returns the WindowProxy of the target browsing context. ```APIDOC ## [GET] window.open() ### Description Opens a new browsing context or navigates an existing one by name, optionally creating an auxiliary browsing context. ### Method GET ### Endpoint window.open(url, target, features, replace) ### Parameters #### Path Parameters None. #### Query Parameters None. #### Request Body - **url** (string) - Required - The URL to navigate to. If empty, navigates to about:blank. - **target** (string) - Required - The name of the browsing context. If empty, defaults to "_blank". - **features** (string) - Optional - A string of comma-separated features for the new window, interpreted per the CSSOM View specification. - **replace** (boolean) - Optional - Indicates whether to replace the current entry in the session history. ### Request Example ```javascript window.open("https://example.com", "_blank", "width=500,height=400"); ``` ### Response #### Success Response (200) - **WindowProxy** (object) - The WindowProxy object of the target browsing context. #### Response Example ```json { "windowProxy": {} // WindowProxy object of the target browsing context } ``` ``` -------------------------------- ### WebVTT chapter track example Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Shows the WebVTT cue format for chapter tracks, with time ranges and chapter titles. ```webvtt 01:30:00.000 --> 01:35:00.000 Answers to Last Exam 01:35:00.000 --> 01:40:00.000 Coursework Description 01:40:00.000 --> 02:30:00.000 General Relativity 01:40:00.000 --> 02:00:00.000 Tensor Algebra 02:00:00.000 --> 02:30:00.000 The General Relativistic Field Equations ``` -------------------------------- ### Ambiguous heading example:
Welcome to...
The computer said Too much cheese in tray two but I didn’t know what that meant.
``` -------------------------------- ### Markup for a toolbar menu with meter elements Source: https://www.w3.org/TR/2016/WD-html51-20160310/sec-forms.html Example of a toolbar menu with links and a list of groups, each showing a meter element with value attributes. The meter elements indicate activity levels. ```htmlcomp.infosystems.www.authoring.stylesheets - join
Group description: Layout/presentation on the WWW.
netscape.public.mozilla.xpinstall - join
Group description: Mozilla XPInstall discussion.
12345
``` -------------------------------- ### WebVTT metadata track example for scores Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Shows a WebVTT file fragment with metadata cues for match type, match number, and team scores, demonstrating the recommended practice of using cues that span the duration of the relevant event. ```webvtt WEBVTT ... 05:10:00.000 --> 05:12:15.000 matchtype:qual matchnumber:37 ... 05:11:02.251 --> 05:11:17.198 red:78 05:11:03.672 --> 05:11:54.198 blue:66 05:11:17.198 --> 05:11:25.912 red:80 05:11:25.912 --> 05:11:26.522 red:83 05:11:26.522 --> 05:11:26.982 red:86 05:11:26.982 --> 05:11:27.499 red:89 ... ``` -------------------------------- ### Sudoku table markup example Source: https://www.w3.org/TR/2016/WD-html51-20160310/tabular-data.html An example of a table used to mark up a Sudoku puzzle, showing the lack of headers. Includes scoped styles and table structure. ```html| 1 | 3 | 6 | 4 | 7 | 9 | |||
| 2 | 9 | 1 | ||||||
| 7 | 6 | |||||||
| 2 | 4 | 3 | 9 | 8 | ||||
| 5 | 9 | 7 | 1 | |||||
| 6 | 5 | 2 | ||||||
| 7 | ||||||||
| 9 | 8 | 2 | 5 |
Welcome to this example.
``` -------------------------------- ### media.readyState Source: https://www.w3.org/TR/2016/WD-html51-20160310/semantics-embedded-content.html Returns the current ready state of the media element, which can jump between states discontinuously. ```APIDOC ## media.readyState ### Description Returns the current ready state of the media element, which can jump between states discontinuously. ### Property readyState (read-only) ### Return Value Number - The current ready state (e.g., HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, HAVE_ENOUGH_DATA). ### Example ```js const state = media.readyState; ``` ``` -------------------------------- ### addShortcutKeyLabel example Source: https://www.w3.org/TR/2016/WD-html51-20160310/editing.html Shows how to add a shortcut key label to an element using the addShortcutKeyLabel method. The label displayed varies by platform and key combination. ```javascript addShortcutKeyLabel(document.getElementById('c')); ``` -------------------------------- ### Unquoted attribute value syntax example: value=yes Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html Shows the unquoted attribute value syntax where the value is not enclosed in quotes. The example uses the 'value' attribute with the value 'yes'. ```html ``` -------------------------------- ### HTML example with parser-implied tags Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html This example shows the document with the omitted tags shown in their parser-implied positions, illustrating that the only white space text node is the newline at the end of the head element. ```htmlWelcome to this example.
``` -------------------------------- ### kbd element: indicating keys to press Source: https://www.w3.org/TR/2016/WD-html51-20160310/textlevel-semantics.html Shows how to mark up keyboard input with nested kbd elements to represent individual keys. The example instructs the user to press Shift+F3. ```htmlTo make George eat an apple, press Shift+F3
``` -------------------------------- ### Single-quoted attribute value syntax example: type='checkbox' Source: https://www.w3.org/TR/2016/WD-html51-20160310/syntax.html Shows the single-quoted attribute value syntax where the value is enclosed in single quotes. The example uses the 'type' attribute with the value 'checkbox'. ```html ```