Fundamentals Beginner
What is HTML?
HTML is the markup language browsers parse to create the structure and meaning of a web document. It describes content with elements such as headings, links, images, forms, tables, and landmarks. HTML quality affects accessibility, SEO, browser defaults, and how safely CSS and JavaScript can build on the page.
Build a basic document → Fundamentals Beginner
What is the DOM?
The DOM is the browser-created object tree that represents the parsed document. JavaScript reads and changes the DOM, and CSS selectors match elements in it for styling. The live DOM can differ from the original HTML source after parsing fixes or script updates.
Review the DOM → Fundamentals Beginner
What is the difference between tags and elements?
A tag is the written markup token, such as an opening or closing marker. An element is the full parsed node, including the tag, attributes, content, and browser-defined meaning. Void elements such as img do not have closing tags, which is a common edge case.
Review HTML tags → Fundamentals Beginner
What does a valid HTML document structure include?
A valid document starts with a doctype, an html element with a language, a head for metadata, and a body for visible content. The head should include charset, viewport, title, and other metadata needed by browsers and crawlers. Missing structure can still render, but it creates ambiguity for accessibility, mobile layout, and SEO behavior.
Practice document structure → Metadata + browser Beginner
What belongs in the head and body?
The head contains document metadata, resource hints, styles, scripts, titles, descriptions, and viewport settings. The body contains the content and controls users interact with. Putting visible content or structural landmarks in the head is invalid and can produce unexpected parsing behavior.
Review the head element → Semantics Beginner
What are semantic HTML elements?
Semantic elements describe the meaning or role of content, such as header, nav, main, article, section, footer, button, and form. They give browsers and assistive technology useful information before any custom scripting. Replacing semantic controls with generic div elements often creates extra keyboard and accessibility work.
Review semantic elements → Semantics Beginner
What is the difference between div and span?
div is a generic block-level container, while span is a generic inline container. Neither carries semantic meaning by itself. They are useful for grouping only when a more meaningful element is not available.
Compare div and span → Fundamentals Beginner
What is the difference between block and inline elements?
Block elements normally start on a new line and occupy available width, while inline elements flow inside text. The distinction affects layout, spacing, and how elements accept dimensions. CSS can change display behavior, but the semantic choice should still match the content meaning.
Review block and inline → Semantics Beginner
How should anchors work in HTML?
An anchor creates navigation when it has a useful href. It should describe the destination with link text that makes sense out of context. Use a button instead when the action changes state on the current page rather than navigating.
Review anchors → Semantics Beginner
What does the href attribute do?
href defines the target URL or fragment for an anchor or linked resource. A missing or fake href can break expected link behavior, keyboard navigation, and browser features such as opening in a new tab. For external links, security and referrer behavior may also matter.
Review href behavior → Forms + accessibility Beginner
How should image alt text work?
Alt text should describe the purpose of an informative image. Decorative images usually need empty alt text so assistive technology can skip them. If an image is inside a link, the alt text may need to describe the link action rather than the visual pixels.
Review image alt text → Forms + accessibility Beginner
How do HTML forms work?
A form groups controls and can submit name/value pairs to a server or be handled by JavaScript. Native controls provide keyboard behavior, labels, validation hooks, and browser defaults. The form still needs server-side validation because client-side constraints can be bypassed.
Build labeled forms → Forms + accessibility Beginner
Why are labels better than placeholders?
A label gives a form control a durable accessible name and a larger clickable target. Placeholder text disappears as users type and is not a reliable replacement for a label. Placeholders are best used as examples or hints, not as the only field name.
Review placeholders → Forms + accessibility Intermediate
How does native form validation work?
Native validation uses attributes such as required, type, min, max, pattern, and minlength. The browser can block common invalid submissions and expose useful constraint states. It improves user experience, but server validation remains the real trust boundary.
Practice validation → Semantics Beginner
How should lists and navigation be marked up?
Lists should represent grouped items where order or grouping matters, and navigation should use nav when it identifies a major navigation region. Link lists are often appropriate for menus because they expose both grouping and navigation semantics. Overusing lists for purely visual layout can make the markup noisy.
Practice navigation markup → Forms + accessibility Intermediate
How do accessible tables work?
Data tables need table markup, header cells, and clear relationships between headers and data cells. Captions and scope attributes help users understand row and column meaning. Tables used only for layout create misleading relationships and should be avoided.
Build accessible tables → Metadata + browser Beginner
What metadata should an HTML page include?
A production page usually needs charset, viewport, title, description, canonical when needed, and relevant social metadata. Metadata helps browsers render correctly and helps crawlers understand the page. Missing viewport metadata is a common mobile rendering failure.
Review head metadata → Metadata + browser Intermediate
What are data attributes used for?
data-* attributes store custom, non-sensitive metadata on elements. They are useful for testing hooks, progressive enhancement, and connecting markup to scripts without inventing invalid attributes. They should not become a replacement for semantic attributes or server-trusted data.
Review data attributes → Metadata + browser Intermediate
When should you use an iframe?
An iframe embeds another browsing context inside the page. It is useful for third-party content, isolated documents, maps, videos, and sandboxed experiences. It needs a meaningful title and careful sandbox, permissions, loading, and security choices.
Review iframes → Metadata + browser Intermediate
How do srcset and sizes work for images?
srcset provides candidate image resources, and sizes tells the browser how much layout width the image will occupy. The browser uses that information with device characteristics to choose an efficient image. Wrong sizes values can make the browser download images that are too large or too blurry.
Review responsive images → Metadata + browser Advanced
How does browser HTML parsing affect the DOM?
Browsers parse HTML into tokens and build the DOM while applying error-recovery rules. Invalid nesting can be corrected into a different DOM than the source appears to describe. Debugging markup issues often means inspecting the live DOM, not only the source file.
Review parsing behavior → Forms + accessibility Intermediate
When should ARIA roles be used?
ARIA roles should be used when native HTML cannot express the needed role, state, or relationship. Native elements are usually better because they include built-in keyboard and accessibility behavior. Misused ARIA can create a worse accessibility tree than plain semantic HTML.
Review ARIA roles → Modern + scenarios Advanced
What is Shadow DOM?
Shadow DOM provides an encapsulated DOM tree for a component. It can isolate markup and styles from the main document while still exposing slots and public component behavior. Accessibility, focus, and styling hooks still need deliberate design.
Review Shadow DOM → Modern + scenarios Advanced
How should native dialog behavior work?
The dialog element can provide native modal semantics and focus handling support. A usable dialog still needs a clear name, predictable opening focus, escape behavior, and focus restoration. A visually correct overlay is incomplete if keyboard users can reach background content.
Practice dialog accessibility → Modern + scenarios Intermediate
What is the difference between HTML, HTML5, and XHTML?
HTML is the markup language used for web documents, and HTML5 is the common name for modern HTML features and parsing behavior. XHTML is an XML-based syntax with stricter parsing rules. Modern web work usually follows the HTML Living Standard rather than treating HTML5 as a frozen version.
Compare HTML and XHTML →