UI developer interview questions.
A UI developer interview is about building the interface well: semantic HTML, CSS that holds up at every screen size, components that work with a keyboard, and the small builds a UI round asks for, such as tabs, a modal, a carousel or a form with validation. These questions cover HTML, CSS and UI machine coding at easy and medium level.
8 of these questions have free answers; the rest are in Pro. Updated .
170
questions
- Easy
- 30
- Medium
- 140
What interviewers look for
- You build layouts with flexbox and grid that work from a phone to a wide screen.
- You write semantic HTML first and add ARIA only when no element does the job.
- Components you build work with the keyboard and a screen reader, not just the mouse.
- You know the cascade, specificity and the box model well enough to debug a layout quickly.
Concept questions, answered
The definitions and comparisons interviewers open with. Free to read, each with a full answer and examples.
What is semantic HTML, and why does it matter?
Semantic HTML means choosing elements for what the content is, not how it looks: <button> for actions, <nav> for navigation, <h2> for a heading. Browsers, screen readers and search engines read those elements to understand the page. You get keyboard support, accessible names and a usable document outline without writing extra JavaScript or ARIA.
What is the CSS box model?
The CSS box model says every element is a rectangular box made of four layers: content, padding, border and margin, from the inside out. The width and height you set apply to the content box by default, so padding and border make the element larger. Setting box-sizing: border-box makes width include padding and border instead.
How does CSS specificity work?
CSS specificity is the score the browser gives each selector to decide which rule wins when several set the same property on one element. It counts IDs first, then classes, attributes and pseudo-classes, then element types. A higher score wins regardless of source order, and when scores tie, the rule that appears later wins.
Flexbox vs Grid: when to use which?
Use Flexbox to lay items out along one axis, a row or a column, where the content decides how much space each item takes. Use CSS Grid to lay out rows and columns together, where the layout decides where each item goes. Most pages use both: Grid for the page and large regions, Flexbox for the components inside them.
position relative vs absolute vs fixed vs sticky in CSS
position: relative keeps an element in the normal flow and lets you nudge it from its own spot. absolute removes it from the flow and places it against the nearest positioned ancestor. fixed places it against the viewport so it stays on screen while scrolling. sticky acts like relative until a scroll threshold, then sticks like fixed inside its parent.
What is z-index, and what is a stacking context?
z-index sets which overlapping elements paint on top, with higher values in front. It only competes with elements in the same stacking context, which is an isolated group of layers. A child can never rise above something outside its own context, however large its z-index, which is why z-index: 9999 sometimes appears to do nothing.
em vs rem vs px vs % in CSS
px is a fixed CSS pixel. em is relative to the font size of the element itself (or its parent, when used in font-size), so it compounds when nested. rem is relative to the root element's font size, so it stays predictable. % is relative to a reference that depends on the property: usually the parent's size, or the parent's font size for font-size.
What is mobile-first responsive design with media queries?
Mobile-first responsive design means you write the base CSS for the smallest screens first, then use min-width media queries to add layout and detail as the viewport gets wider. The base styles work for everyone, and larger screens only receive overrides. It keeps the CSS smaller and forces you to decide what really matters on a narrow screen.
How do srcset and sizes make images responsive?
srcset gives the browser a list of image files with their widths or pixel densities, and sizes tells it how wide the image will be shown in the layout. The browser combines that with the screen's pixel density and picks the smallest file that still looks sharp. You offer choices; the browser decides.
What are pseudo-classes and pseudo-elements in CSS?
A pseudo-class selects an element that is in a particular state or position, such as :hover, :focus-visible, :checked or :nth-child(2). A pseudo-element selects a part of an element, or creates a virtual one, such as ::before, ::after, ::first-line or ::placeholder. Pseudo-classes use one colon, pseudo-elements use two.
How do you make forms accessible?
To make a form accessible, give every control a visible <label> tied to it, group related controls in a <fieldset> with a <legend>, mark required fields with required and words, add autocomplete tokens, and write errors as text linked to the field with aria-describedby and aria-invalid="true". On a failed submit, move focus to an error summary or the first invalid field. Never use a placeholder as the label.
Reflow vs repaint: what is the difference?
Reflow (also called layout) recalculates the size and position of elements when geometry changes. Repaint redraws pixels when only appearance changes, such as colour. Every reflow is followed by a repaint, but a repaint can happen alone. Reflow is more expensive because it can affect many other elements, so avoid triggering it repeatedly.
Easy30
- Mark up a recipe page with semantic HTML onlyFreeScreen readers, search engines and reader modes understand a page through its elements, not its classes. A recipe built…
- Truncate text with an ellipsis on one line and clamp it to three linesFreeCards in a feed have a fixed size, but titles and excerpts do not. The usual fix is to cut the title to one line with…
- Mark up an accessible cart table with a caption, header cells and a footer totalA shopping cart is real tabular data: rows of products, columns of price, quantity and subtotal. Built from <div>s, a…
- Mark up a blog post with article, header, time, figure and a comment sectionA blog post page has a title block, a cover image, the text, tags and a list of comments. Mark it up so each part uses…
- Style a custom checkbox and radio button that stay keyboard and screen reader accessibleDesign systems rarely use the browser's default checkbox. The common mistake is to hide the input with display: none and…
- Keep a footer at the bottom of short pages with flexbox and with gridOn a page with little content, the footer floats up to the middle of the screen and leaves a blank strip under it. It…
- Number nested lists as 1, 1.1 and 1.1.1 with CSS countersLegal documents, specs and tables of contents number their sections as 1, 1.1, 1.1.1. An <ol> only numbers within one…
- Draw a hairline 0.5px border that stays sharp on high-density screensOn a phone with a device pixel ratio of 2 or 3, a 1px CSS border is two or three physical pixels thick and looks heavy…
- Draw a doughnut chart from percentages with conic-gradientSmall dashboards often need one doughnut chart, and a charting library is a lot of code for it. A conic-gradient draws…
- Fill text with a gradient and keep padding on every line of a wrapped highlightLanding pages often show one word of a heading in a colour gradient, and a sentence below it highlighted like a marker…
- Build a three-column social feed layout with sticky sidebars using CSS gridSocial apps lay out the home page in three columns: navigation on the left, the feed in the middle, trends on the right.…
- Build a notifications bell with a count badge and a dropdown panel using only CSSEvery app header has a bell icon with a red count and a panel that drops down when you click it. It is usually built…
- Build a responsive card grid that fits as many columns as it can without media queriesA card grid on a product or blog page should show four columns on a wide screen, two on a tablet and one on a phone.…
- Lay out a magazine article in CSS columns with a spanning heading, a pull quote and no split figuresMagazine and newspaper sites flow long articles through several columns on wide screens and a single column on phones.…
- Mark up an accessible signup form with labels, a fieldset, hints and error messagesSignup forms are often built from inputs with placeholders and red text that only sighted users can connect to a field.…
- Style an FAQ accordion with
detailsandsummary, including a rotating markerAn FAQ is a list of questions that open to show their answers. Native <details> and <summary> already do this with… - Keep a table's header row and first column fixed while it scrolls both waysA wide data table (a gradebook, a timesheet, a price list) on a small screen needs to scroll both ways. Once it does,…
- Embed a responsive 16:9 video and crop images to fit with
aspect-ratioandobject-fitVideo embeds and user photos come in every shape. An embedded player should always be 16:9 at whatever width the column… - Draw a speech bubble, a triangle and a ribbon with borders and
clip-pathTooltips, chat bubbles, play icons and "New" badges are small shapes that are not worth an image or an SVG. CSS draws… - Add a skeleton loading shimmer that stops when reduced motion is requestedSkeleton screens show grey placeholders in the shape of the content while it loads, often with a light band sweeping…
- Build a responsive navigation that collapses into a
detailsmenu on small screensA site header shows its links in a row on wide screens and collapses them behind a "Menu" button on phones. The usual… - Style form validation states with
:user-invalid,:placeholder-shownand:focus-visibleA form that turns red before anyone has typed feels like it is scolding the user. CSS now has pseudo-classes that wait… - Build a pricing table whose plan features and buttons line up across cards with subgridPricing pages show plans side by side. When one plan has a longer name or more features, its price and button slide down…
- Build a horizontal carousel with CSS scroll snap and a peek at the next cardProduct rails and story cards scroll sideways on phones. They should stop with a card neatly aligned, not halfway…
- Write mobile-first media queries for a product listing page: two, three and four columns and a filter sidebarFreeA fashion store's product listing page must work from a 320px phone to a desktop. Phones show two products per row and…
- Restyle a card list with CSS only, without editing the HTML or the existing stylesheetFreeA restaurant list renders the markup below with an existing stylesheet. You may not change either one: your only tool is…
- Turn a data table into stacked cards on narrow screens without losing the column labelsA transactions table works on a laptop but on a phone its five columns either squash or force sideways scrolling. A…
- Animate an accordion panel open and closed with CSS grid rows instead of measured heightsAn accordion should slide open and closed smoothly. The usual hack measures each panel's height in JavaScript and…
- Hide an element in different ways and pick the right one for layout, clicks, focus and screen readers"How many ways can you hide an element, and which is best?" has no single answer: each technique hides the element from…
- Center a box horizontally and vertically with flexbox, grid, absolute positioning and auto margins"Center a div" is the classic warm-up of a CSS round, and the follow-up is always "now do it another way". Build a…
Medium60
- Build an accessible accordion with keyboard navigationBuild an Accordion component with three props:
- Build a typeahead/autocomplete with caching and keyboard supportFreeBuild an Autocomplete component with these props:
- Build a nested file explorer with add, rename, and deleteBuild a VS Code–style file explorer. A tree node is { id, name, type: "folder" | "file", children? } (folders have…
- Build a sortable and filterable data tableBuild a DataTable component that sorts and filters on the client. It has two props:
- Build a drag-and-drop Kanban boardBuild a Kanban board with the native HTML Drag and Drop API.
- Build a nested comments component with threaded repliesFreeThe API returns comments as a flat list: { id, parentId, author, text }, where parentId is null for top-level comments.
- Build a progress bar system supporting multiple queued animationsBuild a ProgressBars component with two props: duration = 2000 (milliseconds) and concurrency = 3. Solve it in React,…
- Build a multi-select dropdown with search and tagsBuild a MultiSelect component, a controlled multi-select, with these props:
- Build a tree view with expand, collapse, and checkbox selectionBuild a tree of checkboxes like a file-permission or category picker. Nodes are { id, label, children? }; nodes without…
- Build a date picker with keyboard navigation and disabled datesBuild a DatePicker component. Dates are ISO strings ("YYYY-MM-DD"). Its props:
- Build a compound
<Tabs>component with full ARIA and roving tabindexBuild a tabs component with a compound API, so teams can arrange the pieces freely: - Build a toast notification system with a queue, pause on hover and a live regionBuild the toast system a product team would actually ship.
- Build an accessible carousel with autoplay that pauses on hover and focus, swipe and reduced motionBuild a Carousel component with three props: slides (an array of { id, src, alt }, defaulting to five demo slides),…
- Build tic-tac-toe on an N×N board with M in a row to winFreeBuild a TicTacToe component that works on any board size, with two props: size = 3 (the board is size × size) and…
- Build a transfer list with select-all and bulk movesBuild a TransferList component: two lists of items (unique strings) with controls to move items between them, as in…
- Build a one-time-code (OTP) input with paste, backspace and arrow-key supportBuild an OtpInput component, the row of single-digit boxes used for login and payment codes. It has one prop, length =…
- Build Grid Lights that switch off in reverse orderBuild a GridLights component with two props: config = [[1, 1, 1], [1, 0, 1], [1, 1, 1]] and delay = 300. Solve it in…
- Build Wordle with correct scoring for repeated lettersBuild the word game Wordle as a Wordle component with three props: answer = "crane", words = ["slate", "trace", "crate",…
- Build a memory card-matching gameBuild a MemoryGame component: a grid of face-down cards where each symbol appears twice, and the player flips two at a…
- Build a grid where dragging selects a rectangle of cellsSpreadsheets, calendars and seat pickers let you drag across cells to select a block. Build <SelectableGrid rows={5}…
- Build a movie-theatre seat picker like BookMyShowBuild a SeatPicker component, the seat-selection screen of a movie-booking app. Solve it in React, Vue, Angular or…
- Build a resizable split pane with pointer and keyboard supportCode editors, email clients and dashboards let you drag the divider between two panels. Build <SplitPane…
- Build the Snake game with a pure game loopBuild Snake in two layers: pure game logic that is easy to test, and a React component that runs it.
- Build a users CRUD screen with filter, select, create, update and deleteAdmin panels are mostly create-read-update-delete screens. Build a UsersDatabase component with one prop, initialUsers:…
- Build a flight booker form with one-way and return date validationBuild a FlightBooker component, a small form with dependent fields (from the classic 7GUIs list). It has one prop, today…
- Build Whack-A-Mole with a timed game loopBuild a WhackAMole component with four props: holes = 9, duration = 15000 (ms), popTime = 1000 (ms) and random =…
- Build an accessible SVG histogram from raw dataShow how a set of numbers (birth years, response times, prices) is distributed, without a chart library.
- Build a drag-and-drop file uploader with progress, cancel and retryGoogle Drive, Gmail attachments and every profile-photo form need an uploader. Build <FileUploader upload={upload}…
- Build a chat window that sticks to the bottom and keeps its position when loading historyWhatsApp Web, Slack and every support widget get scrolling subtly wrong. Build <ChatWindow messages={messages}…
- Build a keyboard-accessible sortable listTrello, Jira and playlist apps let you reorder items by dragging, which keyboard and screen-reader users cannot do.…
- Build a todo list app in React with editing, filters and persistenceFreeThe todo list is the most asked machine-coding question, and interviewers judge the details. Build <TodoApp…
- Build a quiz app in React with navigation, progress and scoringA quiz app is a frequent React machine-coding round: load questions from an API, let the user move between them, then…
- Build a tags input that turns text into removable chipsEmail "To" fields, skill pickers and label editors turn typed text into chips. Build a TagsInput component with these…
- Build an accessible tooltip that flips and stays on screenTooltips look simple, but interviewers check positioning near the viewport edges and the accessibility rules (WCAG…
- Build a drawing pad that keeps strokes intact outside its bounds with pointer captureA signature pad works with a mouse in the middle of the box. Then users report three bugs: a line breaks when the pen…
- Build an accessible two-thumb price range sliderShopping filters use a slider with two thumbs for a price range. Two <input type="range"> elements stacked on top of…
- Build an async settings switch with optimistic updates, rollback and out-of-order responsesA settings page has toggles that save to the server. Waiting for the server before flipping feels slow, so the switch…
- Build a chat composer that does not send while an IME is composingA chat app sends the message when the user presses Enter. Users typing Japanese, Chinese or Korean report that their…
- Build a counter with step size, min/max bounds, reset and undo/redoA counter is the usual warm-up in a machine-coding round. The interviewer then adds requirements one at a time: a…
- Build Minesweeper with a safe first click, iterative flood fill and flagsBuild Minesweeper as a Minesweeper component with four props: rows = 9, cols = 9, mines = 10 and random = Math.random (a…
- Build a calculator with
useReducer: chained operations, backspace and divide-by-zero errorsBuild a pocket calculator. The buttons are easy; the interview is about the state: what happens when the user presses +… - Build Connect Four with gravity drops, four-direction wins and keyboard playBuild a ConnectFour component (no props) on the standard 7-column, 6-row board. Discs fall to the lowest empty cell of a…
- Build Simon Says with timed playback, input checking and a best scoreSimon shows a sequence of coloured flashes, the player repeats it, and each round adds one more colour. The rules are…
- Build a phone number input that formats as you type and keeps the caret in placeA phone field that inserts brackets and dashes while you type looks simple. The hard parts are the caret, which jumps to…
- Build a month calendar with a six-row grid, navigation and events per dayA month view is a staple machine-coding round: a grid of days, buttons to change month, and events on each day. Most…
- Build a GitHub-style contribution heatmap with levels, month labels and tooltipsA contribution graph shows a year of daily activity as a grid of squares: one column per week, one row per weekday,…
- Build a tier list with pointer dragging, keyboard moves and an exported rankingA tier list ranks items into rows S, A, B and C, with an unranked pool at the bottom. Build it with pointer events…
- Build a Pomodoro timer with work and break cycles and drift-free timeA Pomodoro timer alternates focus sessions with short breaks, and gives a long break after every 4th session. Build it…
- Build a loan EMI calculator: amortisation, simple vs compound interest and rupee formattingA loan calculator is a popular machine-coding round at fintech companies. The form is easy; the interview is about the…
- Build linked inputs without effect loops: a Celsius/Fahrenheit converter and a recipe scalerTwo inputs that update each other look trivial, and the first attempt is usually two pieces of state kept in sync by two…
- Build an analog clock in SVG: hand angles, a drift-free tick and time zonesThe analog clock is a classic machine-coding round. Drawing the face is easy; interviewers look at three details. Does…
- Build three small games: a dice roller, a colour-guessing game and a reaction timerShort games are common warm-up rounds in machine-coding interviews. They look trivial, and the interviewer watches for…
- Build a pixel art editor: drag to paint, flood fill and a compact export stringBuild a small pixel art editor. It combines three classic pieces: pointer handling that does not drop pixels, a flood…
- Build an interactive soroban abacus with a pure mapping between beads and numbersA soroban is a Japanese abacus. Each vertical rod is one decimal digit, and a horizontal bar divides it. Above the bar…
- Build a notification bell with an unread badge, grouped panel and live announcementsAlmost every product header has a bell icon with a red number on it. Build a NotificationBell component with three…
- Build a flashcard study app: flip, mark, shuffle and review the cards you missedBuild a Flashcards component, a small study app, with two props: cards (an array of { id, front, back }; it defaults to…
- Build a URL shortener UI with validation, history and copy-to-clipboard statesBuild the front end of a link shortener: the user pastes a long URL, gets a short one, and copies it. Write two things.
- Build a restaurant reservation widget with date validation and accessible time slotsBuild <ReservationWidget today="2026-10-23" getAvailability={fn} reserve={fn} maxPartySize={8} />, the booking box on a…
- Build small form UX components: character counter, password reveal toggle, skeleton loader and step indicatorMachine coding rounds often ask for several small components instead of one big one, because the details show whether…
- Build an accessible tree view: roving tabindex, arrow keys, typeahead and lazy-loaded foldersA file tree you can only use with a mouse fails an accessibility review. Build a TreeView that follows the WAI-ARIA tree…
Showing 60 of 140 medium questions. Browse the rest in the question bank
Practise with tests and full answers.
Every question has a runnable editor, tests and a step-by-step solution. Passes from ₹149, paid once; nothing renews.
Frequently asked
What questions are asked in a UI developer interview?
HTML semantics and forms, the CSS box model, specificity, flexbox versus grid, positioning, responsive design with media queries, browser rendering, accessibility, and a machine coding round where you build a component such as tabs, an accordion, a modal or an autocomplete in HTML, CSS and JavaScript or React.
What is the difference between a UI developer and a frontend developer?
The titles overlap and many companies use them for the same job. Where they differ, a UI developer focuses on HTML, CSS, design systems and building components that match the design, while a frontend developer also owns more application logic, data fetching and state.
What do experienced UI developers get asked?
Deeper CSS (stacking contexts, containment, layout performance), accessibility audits, building a design system component with a clean API, responsive images, and performance topics such as layout shift and rendering cost.