HTML Beginner
What is semantic HTML?
Semantic HTML uses elements that describe the meaning and structure of content, such as header, nav, main, article, section, button, and form. It helps browsers, search engines, assistive technologies, and other developers understand the page without guessing from class names. A common failure is replacing native buttons, links, and headings with generic div elements that then need extra keyboard and accessibility work.
Practice semantic HTML → HTML Beginner
What is the DOM?
The DOM is the browser-created object tree that represents the parsed HTML document. JavaScript reads and updates this tree, while CSS selectors match elements in it for styling. The source HTML and live DOM can differ after scripts run, so debugging often means inspecting the current DOM instead of only reading the original markup.
Accessibility Beginner
How should labels work in HTML forms?
A form control needs a durable accessible name, usually from a label associated with for and id or by wrapping the control. Labels increase the clickable target and help screen-reader users understand the field. Placeholder text is not a replacement because it disappears during input and may not be announced as a stable label.
Build labeled forms → Accessibility Beginner
What is accessibility in HTML and CSS?
Accessibility means the UI can be understood and operated by people using keyboards, screen readers, zoom, high contrast, or other assistive technology. HTML provides much of the semantic contract, while CSS must preserve readable contrast, focus visibility, and usable layout. A design can look correct but still fail if focus order, labels, or hidden content are wrong.
Review accessibility fixes → Accessibility Beginner
How should alt text work for images?
Alt text describes the purpose of an image when the image carries information. Decorative images should usually have empty alt text so assistive technology can skip them. The edge case is an image inside a link or button, where the alt text may need to describe the action rather than the visual pixels.
Practice links and images → HTML Beginner
When should you use a button instead of a link?
Use a link for navigation to another URL or location, and use a button for an action on the current page. Native elements provide the expected keyboard behavior, roles, focus handling, and activation events. A fake link or fake button often breaks keyboard access unless you rebuild behavior the browser already gives you.
HTML Intermediate
How does native form validation work?
Native validation uses attributes such as required, type, min, max, pattern, and minlength to let the browser check common constraints. It reduces custom JavaScript but should be paired with clear labels and useful error text. Server-side validation is still required because client-side validation can be bypassed.
Practice form validation → HTML Beginner
What metadata belongs in the head?
A production document should include charset, viewport, title, useful description, canonical when needed, and relevant social metadata. These tags help browsers render correctly and help crawlers understand the page. Missing viewport metadata is a common mobile bug because the layout may render at a desktop-style width on phones.
Review head metadata → CSS Beginner
How do HTML structure and the CSS box model shape a component?
HTML decides which elements and content make up the component, while the CSS box model determines the space each element occupies. Native elements also bring display defaults that affect sizing and flow. Debug the live element tree together with content, padding, border, margin, and box-sizing instead of treating the stylesheet as an isolated diagram.
Review the box model → CSS Intermediate
How should HTML state hooks participate in the CSS cascade?
Classes, data attributes, and ARIA states can expose meaningful component state for CSS without changing native semantics. The cascade then resolves competing base, component, state, and override rules. Prefer stable state hooks and predictable layers over selectors that depend on fragile DOM depth or visual-only class names.
Review cascade order → CSS Intermediate
How can semantic markup avoid CSS specificity conflicts?
Start with the correct native elements and shallow component or state selectors, then let cascade layers define broader priority. Semantic markup removes many styling and behavior workarounds that otherwise invite deeply nested selectors. When a conflict appears, inspect the winning rule and simplify the selector contract instead of adding another ID or !important.
Practice specificity → CSS Beginner
How should a semantic navigation use Flexbox?
Keep the navigation landmark, list, links, source order, and current-page semantics in HTML, then use Flexbox for one-dimensional alignment, spacing, and wrapping. The narrow layout must preserve every destination and a logical keyboard order. Flexbox should arrange the navigation, not replace its semantic structure.
Review Flexbox → CSS Intermediate
How should CSS Grid preserve semantic page and card structure?
Use landmarks, sections, articles, headings, and meaningful source order to describe the content, then let Grid place those elements in two dimensions. Visual placement must not create a reading or focus order that contradicts the DOM. Grid can remove layout-only wrappers, but it should not turn meaningful content into anonymous boxes.
Compare Grid and Flexbox → CSS Intermediate
How do DOM structure and containing blocks affect positioned UI?
A positioned element depends on both its CSS position value and where it sits in the DOM. Positioned ancestors, transforms, and scroll containers can change the containing block used by absolute, fixed, or sticky elements. Keep source order meaningful, then inspect ancestor structure before changing offsets or z-index.
Review positioning → CSS Intermediate
How should modal DOM placement and CSS stacking work together?
A modal needs an accessible dialog structure, predictable focus behavior, and placement outside clipping or lower stacking contexts. CSS z-index only compares elements inside the relevant context, so a large value cannot repair every ancestor problem. The DOM and overlay layer should keep the dialog visually above the page while background content is also isolated semantically.
Debug z-index → Responsive + debugging Beginner
How should content structure and media queries adapt together?
HTML should keep one meaningful source and reading order, while media queries change layout, spacing, and presentation when the available environment requires it. Responsive changes must preserve labels, controls, headings, and keyboard access. If a narrow layout hides content, the UI needs another semantic way to reach it.
Review media queries → Responsive + debugging Intermediate
How do responsive images work?
Responsive images use srcset, sizes, picture, and modern loading attributes to let the browser choose an appropriate resource. The goal is to avoid shipping oversized images while preserving sharpness and layout stability. Width and height or aspect-ratio should be set so the page does not jump while images load.
CSS Intermediate
How should component boundaries scope CSS custom properties?
HTML component boundaries identify where a token should be shared or overridden, while custom properties carry the value through the cascade. Keep global design tokens broad and expose narrowly named component hooks near the relevant markup. Test nested components because inherited values can cross a boundary farther than intended.
CSS Intermediate
How do HTML states and CSS pseudo-classes work together?
Native HTML exposes interaction states such as focus, checked, disabled, valid, and invalid that CSS can select without duplicating state in JavaScript. Pseudo-elements can add decoration, but they should not carry essential content that assistive technology needs. The markup owns meaning; selectors such as :focus-visible and :checked express its visual state.
Responsive + debugging Advanced
How do you debug overflow without hiding content or keyboard focus?
Inspect the live HTML to find the element that exceeds its container, then check content length, fixed widths, min-size defaults, layout tracks, and positioned children. The fix must keep meaningful text and focused controls reachable. overflow: hidden can conceal the visual symptom while clipping content or keyboard focus users still need.
Practice responsive fixes → Responsive + debugging Advanced
What causes layout shift?
Layout shift happens when content moves after initial render because dimensions, fonts, ads, images, or async UI were not reserved. Set stable dimensions, reserve space for dynamic regions, and avoid inserting content above what the user is reading. The failure mode is a page that passes visual review but feels unstable while loading.
Accessibility Intermediate
How should focus states be styled?
Focus states should be visible, consistent, and not depend only on color. Use :focus-visible to show keyboard focus without adding noisy outlines for pointer users. Removing outlines globally breaks keyboard navigation and makes interactive elements hard to locate.
CSS Beginner
How do HTML semantics and CSS display values interact?
Native elements have default display behavior, but changing display does not change an element’s semantic role. A link styled as a block is still a link, and a div styled like a button is still not a button. Choose HTML for meaning and interaction first, then choose block, inline, inline-block, flex, or grid for layout.
Responsive + debugging Intermediate
How should CSS units preserve readable, zoomable HTML content?
Use units according to the content contract: rem for root-relative type and spacing, em for component-relative sizing, percentages for containing contexts, and px where a CSS pixel is intentional. Do not lock text or controls into dimensions that break browser zoom or long labels. Test the actual headings, form fields, and actions at narrow widths and increased text size.
Responsive + debugging Advanced
How do you make an HTML and CSS component responsive?
Start with semantic markup and fluid layout constraints, then add breakpoints only where the component actually needs a different structure. Use max-width, minmax(), flexible tracks, wrapping, responsive images, and stable spacing tokens. Test narrow widths, long text, zoom, keyboard focus, and overflow instead of only resizing a desktop viewport.
Practice responsive CSS →