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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

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.

Read the full answer

Easy30

Medium60

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.

Get full access
Rehearse it in a timed frontend mock interviewA real editor with tests, the follow-ups an interviewer asks, and a score out of 100.

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.