[{"id":"htmlbeginner-001","courseId":"html-beginner","domain":"document-structure","topic":"Doctype declaration","prompt":"Put these parts of a complete HTML document in the order the HTML syntax requires, first to last.","hint":"Some parts are optional, but the required preamble still has a fixed place.","explain":"An HTML file is a fixed sequence of parts. Some are optional, and comments or whitespace may fill gaps, but the required preamble and root element have set places. Think about what must come first.","source":"https://html.spec.whatwg.org/multipage/syntax.html#the-doctype","interaction":{"type":"sort","items":[{"text":"Optional U+FEFF byte order mark (BOM)","why":"If used, it is a single character that must come before everything else."},{"text":"Comments and ASCII whitespace before the DOCTYPE","why":"Allowed after the optional BOM and before the required DOCTYPE."},{"text":"The DOCTYPE","why":"The required preamble; it must come before the document element."},{"text":"Comments and ASCII whitespace before the html element","why":"Allowed after the DOCTYPE and before the document element."},{"text":"The html element (the document element)","why":"The single root of the document; it comes last of these parts."}]},"options":[],"answer":"o:abcde","explanation":"A document is made of, in order: an optional BOM, comments and whitespace, a DOCTYPE, comments and whitespace, then the html element.","concept":"A document is made of, in order: an optional BOM, comments and whitespace, a DOCTYPE, comments and whitespace, then the html element.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["The DOCTYPE is required and comes before the html element, which comes last."]},{"id":"htmlbeginner-002","courseId":"html-beginner","domain":"document-structure","topic":"Void elements","prompt":"On a void element such as <img>, a slash before the closing > marks the start tag as self-closing, which is how the element gets closed.","hint":"Think about which elements can never hold any content.","explain":"Some elements can never hold content, and the HTML syntax lists them by name. Think about whether a closing slash on one of those elements changes how the browser reads it.","source":"https://html.spec.whatwg.org/multipage/syntax.html#void-elements","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"On a void element the slash has no effect of any kind, so it cannot close the element."},{"id":"b","text":"False","why":"On void elements the slash does not mark the start tag as self-closing; it is unnecessary and has no effect."}],"answer":"b","explanation":"Void elements such as img, input and br never take content; a slash before > on them is unnecessary and has no effect.","concept":"Void elements such as img, input and br never take content; a slash before > on them is unnecessary and has no effect.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["Writing <img /> is allowed, but on void elements the slash does nothing."]},{"id":"htmlbeginner-003","courseId":"html-beginner","domain":"document-structure","topic":"Lang attribute","prompt":"A page has a div with lang set to es, wrapping a p that has no lang attribute. Under the HTML rules, what language is that paragraph in?","hint":"Think about what an element with no lang attribute gets from its surroundings.","explain":"The lang attribute tells tools such as screen readers which language content is written in. Think about how far one lang value reaches into the elements it contains.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/lang","interaction":{"type":"single"},"options":[{"id":"a","text":"Spanish, inherited from the div","why":"An element with no lang attribute inherits the language of its parent, here es."},{"id":"b","text":"Unknown, since lang applies only to the element that carries it","whyNot":"lang is inherited by descendants; a language is unknown only when no ancestor sets one."},{"id":"c","text":"English, the default, because lang never inherits","whyNot":"No English default exists; lang does inherit, and with no language cue at all the language is unknown."},{"id":"d","text":"Whatever language the browser's interface uses","whyNot":"The browser's interface language is not one of the cues; the page's lang markup decides."}],"answer":"a","explanation":"An element with no lang or xml:lang attribute inherits the language of its parent, so one lang value on a container covers its contents.","concept":"An element with no lang or xml:lang attribute inherits the language of its parent, so one lang value on a container covers its contents.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"<div lang=\"es\">\n  <p>Hola, mundo.</p>\n</div>","takeaways":["Set lang on the html element, and on any part written in a different language."]},{"id":"htmlbeginner-004","courseId":"html-beginner","domain":"document-structure","topic":"Title element","prompt":"You are writing the head of a single web page. Which TWO statements about its title element are correct?","hint":"Think about how many titles a document can hold and what the title is for.","explain":"The title element names the whole document for tabs, bookmarks and search results. Think about what the element may contain and how many a document can have.","source":"https://html.spec.whatwg.org/multipage/semantics.html#the-title-element","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"A document may contain no more than one title element.","why":"The spec allows at most one title element per document, and it sits in the head."},{"id":"b","text":"The title should identify the page even when it is read out of context, such as in bookmarks.","why":"The spec asks authors to write titles that identify the document when used out of context, like bookmarks or search results."},{"id":"c","text":"It may contain other elements, such as em, so its text can be styled.","whyNot":"Its content model is text only; other elements are not allowed inside a title."},{"id":"d","text":"It should copy the page's first h1 heading word for word.","whyNot":"The spec notes the title is often different from the first heading, which need not stand alone."},{"id":"e","text":"It can be left out on every page, since browsers build one from the URL.","whyNot":"The spec allows omission only in special cases, such as when a higher-level protocol like an email subject supplies the title."},{"id":"f","text":"A page can use one title in the head and another in the body for each section.","whyNot":"Only one title element is allowed per document, and it belongs in the head."}],"answer":"ab","explanation":"A document has at most one title element, in the head; it holds only text and should identify the page even when read out of context.","concept":"A document has at most one title element, in the head; it holds only text and should identify the page even when read out of context.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","takeaways":["One title per page, in the head, written so it makes sense out of context."]},{"id":"htmlbeginner-005","courseId":"html-beginner","domain":"document-structure","topic":"Character encoding declaration","prompt":"Your HTML5 page's head contains the declaration shown. What is true of it?","hint":"Look at which values the charset attribute accepts in HTML5.","explain":"The charset attribute tells the browser how the file's bytes map to characters. HTML5 limits which values are allowed, and it also limits where this declaration may sit.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta","interaction":{"type":"single"},"options":[{"id":"a","text":"It is invalid: in HTML5 the charset value must be utf-8.","why":"UTF-8 is the only valid encoding for HTML5 documents, so the value must be utf-8, matched case-insensitively."},{"id":"b","text":"It is valid, since any encoding name the browser supports may be used.","whyNot":"Only utf-8 is allowed as a charset value in HTML5, whatever encodings a browser can decode."},{"id":"c","text":"It is valid, as long as it appears within the first 1024 bytes.","whyNot":"The 1024-byte rule governs where the declaration sits; it does not make other encoding names valid."},{"id":"d","text":"It is valid, because the browser will still read the file correctly.","whyNot":"Being readable is not the same as being valid; the attribute's value must be utf-8."}],"answer":"a","explanation":"In HTML5 a meta charset value must be utf-8 (case-insensitive), and the declaration must sit within the first 1024 bytes of the document.","concept":"In HTML5 a meta charset value must be utf-8 (case-insensitive), and the declaration must sit within the first 1024 bytes of the document.","rev":1,"updatedAt":"2026-10-23","kind":"scenario","code":"<meta charset=\"ISO-8859-1\" />","takeaways":["Declare <meta charset=\"utf-8\"> early in the head, within the first 1024 bytes."]}]