interview.practice

HTML and CSS from Scratch interview questions

Answer aloud before opening each explanation. Focus on the reasoning, not memorized wording.

SemanticsAccessibilityCascadeLayoutResponsiveSizingArchitecture

0/8 saved answers | 8 questions shown

01Why use semantic HTML?SemanticsBeginner

Model answer

It communicates content meaning to browsers, assistive technology, search engines, and developers.

Why

Meaningful elements improve navigation and maintenance beyond visual appearance.

02Why is a placeholder not a replacement for a label?AccessibilityBeginner

Model answer

It disappears during input and may not provide a reliable accessible name.

Why

A persistent associated label explains the control to every user.

03What determines which matching CSS declaration wins?CascadeBeginner

Model answer

Origin, importance, specificity, and source order.

Why

The cascade resolves competing declarations in a defined priority order.

04When should you choose Flexbox instead of Grid?LayoutIntermediate

Model answer

When layout is mainly along one row or one column.

Why

Flexbox is one-dimensional while Grid coordinates rows and columns.

05What is mobile-first CSS?ResponsiveIntermediate

Model answer

Writing the base layout for constrained screens and adding enhancements as space grows.

Why

This usually produces simpler defaults and progressive layout changes.

06What does box-sizing: border-box change?SizingIntermediate

Model answer

Declared width and height include padding and border.

Why

Border-box makes component sizing more predictable.

07What makes visible focus indicators important?AccessibilityAdvanced

Model answer

Keyboard users need to know which interactive element currently receives input.

Why

Removing focus outlines without a replacement breaks keyboard navigation.

08How can CSS custom properties improve a design system?ArchitectureAdvanced

Model answer

They centralize semantic values such as colors, spacing, and component states.

Why

Semantic tokens make themes and consistent changes easier to maintain.

Back to track