HTML & CSS Middle cheat sheet: interview answers

Every question of this level with its correct answer and explanation, on one page for a quick review before the interview.

Quick reference: Key concepts and pitfalls on a couple of pages →
  1. 1. What is the specificity of the selector nav#main .item:hover > a::before?

    Correct answer: (1, 2, 3) - an ID, class + pseudo-class, two types + pseudo-element

    Count by column: IDs - #main (1); classes, attributes and pseudo-classes - .item and :hover (2); types and pseudo-elements - nav, a, ::before (3). Combinators (>, space) add no specificity. A pseudo-class weighs like a class, and a pseudo-element like a type selector.

  2. 2. How do you override a third-party library's !important rule without touching its code?

    Correct answer: Write your own rule also with !important and a more specific selector

    A normal rule never beats !important, however specific it is. Among several !important declarations, specificity and order apply again. Other options: an inline style with !important, or cascade layers - for !important the layer order is reversed. The best path is avoiding !important in your own code.

  3. 3. What does the shorthand flex: 1 expand to?

    Correct answer: flex-grow: 1; flex-shrink: 1; flex-basis: 0%

    flex: 1 = 1 1 0%: the base size is zero, so all space is split strictly in proportion to flex-grow - columns end up equal regardless of content. flex: auto = 1 1 auto - only the free space beyond content size is shared. flex: none = 0 0 auto.

  4. 4. How does flex-basis differ from width on a flex item in a row (flex-direction: row)?

    Correct answer: flex-basis is the initial main-axis size; if it isn't auto, it takes precedence over width

    flex-basis sets the item's initial size along the main axis, from which grow and shrink are computed. With flex-basis: auto, width is used (or height in a column). With flex-direction: column, flex-basis applies to height rather than width - that's the key difference from width.

  5. 5. Inside a flex item, long text with text-overflow: ellipsis doesn't truncate and stretches the column instead. How do you fix it?

    Correct answer: Give the flex item min-width: 0 (or overflow: hidden)

    Flex items have min-width: auto by default - they won't shrink below their minimum content. A long word or a white-space: nowrap line stretches the item. min-width: 0 allows shrinking, and then ellipsis kicks in. flex-shrink: 0 would only make it worse.

  6. 6. How does repeat(auto-fill, minmax(200px, 1fr)) differ from repeat(auto-fit, minmax(200px, 1fr))?

    Correct answer: auto-fill keeps empty columns, while auto-fit collapses them and stretches the items

    Both create as many columns as fit. The difference shows when there are fewer items than slots: auto-fill keeps the empty tracks, while auto-fit collapses them to zero and 1fr stretches the existing items. For cards that should fill the row, auto-fit is the usual choice.

  7. 7. How do you define a "header on top, sidebar and content in the middle, footer at the bottom" layout in Grid with named areas?

    Correct answer: With grid-template-areas on the container and grid-area on the children

    grid-template-areas describes the layout as string "pictures": "header header" "sidebar main" "footer footer", and items attach via grid-area: header. A dot . marks an empty cell. It's great for responsiveness: a media query only changes the template. There is no grid-area-names property.

  8. 8. What is an implicit grid?

    Correct answer: Tracks the browser creates automatically for items that don't fit the explicit grid

    The explicit grid is defined by grid-template-*. If there are more items than cells, the browser adds implicit tracks sized by grid-auto-rows / grid-auto-columns, with auto-placement direction set by grid-auto-flow. By default implicit rows are auto-sized.

  9. 9. What does place-items: center do on a grid container?

    Correct answer: Shorthand for align-items + justify-items: centers items within their cells

    place-items = align-items + justify-items, i.e. aligning each item within its own cell. Aligning the whole grid (tracks) within the container is place-content (align-content + justify-content). The container itself is centered by its parent's styles.

  10. 10. When is Grid more appropriate, and when Flexbox?

    Correct answer: Grid for two dimensions, Flexbox for one

    Flexbox arranges items along a single axis and suits "content defines size": menus, toolbars, alignment within a component. Grid controls both axes at once and suits "layout defines size": page layouts, galleries. Both are current and often used together.

  11. 11. What does font-size: clamp(1rem, 2.5vw, 2rem) resolve to on a 1000px-wide screen (1rem = 16px)?

    Correct answer: 25px

    clamp(MIN, VAL, MAX) returns VAL bounded below by MIN and above by MAX. 2.5vw at 1000px = 25px, which is between 16px and 32px, so the result is 25px. At 400px it would be 10px → clamped to 16px; at 2000px → 50px → clamped to 32px. This gives fluid typography without media queries.

  12. 12. Why use logical properties like margin-inline-start instead of margin-left?

    Correct answer: They adapt automatically to the writing direction (RTL, vertical text)

    Logical properties follow the text direction: inline is the line axis, block is the block axis, start/end are the beginning and end. In Arabic (RTL), margin-inline-start ends up on the right without extra styles. Shorthands exist too: padding-inline, inset-block, inline-size. They don't affect performance.

  13. 13. How does transition differ from animation?

    Correct answer: transition is a change between two states, animation is a @keyframes sequence

    A transition needs a trigger - a value change (:hover, class change) - and knows only the start and end. An animation is described with keyframes; it can start immediately, repeat (animation-iteration-count), run in reverse and pause (animation-play-state).

  14. 14. Which properties are best to animate for smooth 60 FPS?

    Correct answer: transform and opacity

    transform and opacity are usually handled at the compositing stage and don't trigger layout or paint. Animating width, top or margin forces the browser to recalculate layout every frame, causing jank. That's why you move things with translate, not left.

  15. 15. Why is transform: translate() often better than changing left on a position: absolute element for movement animations?

    Correct answer: translate doesn't change layout, while left recalculates layout every frame

    Moving via transform doesn't affect flow or trigger reflow, so the animation is smoother. left can be animated, but it's more expensive. Both support percentages, but they're computed differently: translate uses the element's own size (hence the translate(-50%, -50%) centering trick), left uses the containing block.

  16. 16. How should will-change be used?

    Correct answer: Sparingly - on elements about to animate, removing it afterwards

    will-change hints the browser to prepare a layer in advance. Used broadly, it eats memory (each layer is a separate texture) and can slow the page down. It's a last resort for a specific performance problem, not a replacement for transition.

  17. 17. What is Critical CSS?

    Correct answer: Above-the-fold styles inlined in <head>; the rest loads later

    External CSS blocks rendering: the browser won't paint until the styles download. Inlining the above-the-fold styles in the HTML and loading the rest asynchronously makes the first paint (FCP/LCP) happen sooner. The downside is duplicated styles and a more complex build.

  18. 18. What does the CLS (Cumulative Layout Shift) metric measure?

    Correct answer: Unexpected layout shifts during the page's lifetime

    CLS measures visual stability: how much content "jumps". A good value is under 0.1. Time to the largest element is LCP, responsiveness is INP. The main causes of shifts are images without dimensions, banners and ads without reserved space, and web fonts.

  19. 19. Which technique best prevents layout shifts caused by loading images?

    Correct answer: Set width and height (or aspect-ratio) to reserve the space

    Knowing the proportions, the browser reserves space before the file loads, so content doesn't jump. Modern browsers compute aspect-ratio from the width/height attributes automatically. Lazy loading without dimensions makes shifts worse, and loading via JS hurts LCP.

  20. 20. What does font-display: swap do in @font-face?

    Correct answer: Shows text in a fallback font immediately and swaps in the web font once loaded

    swap removes "invisible text" (FOIT): users see content in a fallback font right away, then the font changes (FOUT). This can cause a small layout shift, reduced by tuning fallback metrics (size-adjust). The optional value lets the browser skip the font entirely on a slow network.

  21. 21. What are the srcset and sizes attributes on <img> for?

    Correct answer: So the browser picks a file of the right size

    srcset lists file variants (img-400.jpg 400w, img-800.jpg 800w), and sizes hints how wide the image will be in the layout ((max-width: 600px) 100vw, 50vw). The browser downloads the smallest sufficient file. To change cropping or format, use <picture>.

  22. 22. When do you need <picture> rather than just <img srcset>?

    Correct answer: When you need to switch formats (AVIF/WebP with a fallback) or cropping

    <picture> with multiple <source> elements enables art direction (different cropping on mobile via media) and format selection (type="image/avif"), while the inner <img> is the fallback and carries alt. For a simple resolution switch, srcset/sizes on <img> is enough.

  23. 23. What does loading="lazy" on <img> do, and when should you NOT use it?

    Correct answer: Defers loading until the image nears the viewport; avoid it on the LCP image

    Native lazy loading saves bandwidth for below-the-fold images. But for a hero image it's harmful: the browser starts loading later and LCP suffers. For an important image, use fetchpriority="high" instead. The attribute has nothing to do with compression or formats.

  24. 24. What does object-fit: cover do on an <img> with set width and height?

    Correct answer: Keeps proportions and fills the whole box, cropping the excess

    cover fills the entire area, keeps the proportions and crops what sticks out (the focal point is set with object-position). Fitting the whole image with bars is contain. Distorting proportions is the default behavior (fill).

  25. 25. What is the specificity of :where(.card, #hero) p?

    Correct answer: (0, 0, 1) - :where() always contributes zero specificity

    :where() zeroes out the specificity of its arguments, leaving only p - (0,0,1). That's handy for base styles in libraries: they are easy to override. Its sibling :is() takes the specificity of its most specific argument - :is(.card, #hero) p would be (1,0,1).

  26. 26. What does the selector .card:has(img) match?

    Correct answer: Cards that contain at least one <img> image

    :has() is the "parent selector": it matches an element if something inside it (or next to it, with + and ~ combinators) matches the argument. The card itself is styled, not the image. Examples: form:has(:invalid), label:has(+ input:checked). Attributes are selected with [attr].

  27. 27. How do CSS variables (--x) fundamentally differ from Sass variables ($x)?

    Correct answer: --x lives in the browser and changes at runtime, while $x is substituted at build time

    A Sass variable is a compile-time value; it doesn't exist in the output CSS. A custom property takes part in the cascade: it can be overridden per component, in @media, on :hover, in a dark theme, or from JavaScript via style.setProperty. They're usually combined: Sass for build logic, CSS variables for themes and dynamics.

  28. 28. What is a stacking context, and why might z-index: 9999 "not work"?

    Correct answer: A group within which z-index values compare; a child can't rise above its parent's siblings

    An element with position + z-index, opacity < 1, transform, filter, isolation: isolate and so on creates its own stacking context. Everything inside it is painted as a single unit relative to its siblings. If a parent with z-index: 1 is below a sibling with z-index: 2, a child with 9999 still ends up below that sibling.

  29. 29. position: sticky isn't working even though top: 0 is set. What's the most likely cause?

    Correct answer: One of the ancestors has overflow: hidden, auto or scroll

    A sticky element sticks to its nearest scrolling ancestor. If an ancestor's overflow isn't visible, sticky is measured against it, and that ancestor may not scroll at all - visually nothing happens. Another cause: the parent is no taller than the element, so there's nowhere to stick. To clip without creating a scroll container, use overflow: clip.

  30. 30. What is a block formatting context (BFC), and how do you create one?

    Correct answer: An isolated layout region, e.g. via display: flow-root

    A BFC is an isolated layout region: it contains its floats (doesn't collapse in height) and prevents children's margins from collapsing with the parent's. It's created by display: flow-root (the modern way), overflow other than visible, flex/grid items, position: absolute, etc. It used to be the clearfix technique.

  31. 31. What's new about the @media (width >= 768px) syntax?

    Correct answer: It's the range syntax from Media Queries Level 4, equivalent to min-width

    Range syntax allows comparisons: (width >= 768px), (400px <= width < 1000px). It's shorter and avoids min/max confusion at the boundaries. All modern browsers support it, and Tailwind v4 generates breakpoints in this form. Container queries are written with @container.

  32. 32. What are @container container queries for?

    Correct answer: To style a component by its container's size

    Media queries look at the viewport, but a component may sit in a narrow sidebar or a wide column. Container queries let a card adapt to its actual space: the parent gets container-type: inline-size, and styles use @container (width > 400px) { ... }. @media is not deprecated.

  33. 33. Why can height: 100vh be taller than the visible area on mobile, and how do you fix it?

    Correct answer: vh ignores the address bar; the dvh, svh, lvh units help

    Mobile browsers compute 100vh from the maximum height (with the toolbar hidden), so the bottom of the block hides under the address bar. The new units: svh - smallest viewport height, lvh - largest, dvh - dynamic, changing along with the toolbar.

  34. 34. What does the currentColor value mean?

    Correct answer: The value of the current element's color property

    currentColor substitutes the computed color value. It's handy for SVG icons (fill: currentColor), borders and shadows that should match the text color: change color on :hover, and the icon recolors along with the text.

  35. 35. How do the initial, inherit and unset values differ?

    Correct answer: Spec value, parent's value, or either one by property

    initial takes the value from the CSS specification (for display that's inline, not the browser's block for div). Browser-style values are restored by revert. inherit takes the parent's computed value. unset acts as the "natural" value: inherited properties inherit, others reset to initial.

  36. 36. In BEM, how do you correctly name the title class inside a card block in its "accent" variant?

    Correct answer: card__title card__title--accent

    BEM: block (card), element with two underscores (card__title), modifier with two dashes (card__title--accent). The modifier goes together with the base class so base styles aren't duplicated. A flat class structure gives low, uniform specificity and a predictable cascade.

  37. 37. How do CSS Modules solve class-name collisions?

    Correct answer: They generate unique class names, making styles local to the file

    The .title class from Card.module.css becomes something like Card_title__x7a2b, and the component imports a mapping object. Collisions disappear without naming conventions. Global styles use :global. Shadow DOM is a Web Components mechanism; CSS Modules don't use it.

  38. 38. Why is :focus-visible better than :focus for styling the focus outline?

    Correct answer: It shows the outline mainly for keyboard users

    Designers used to ask to remove the "ugly" ring after a click, and outline: none broke keyboard accessibility. :focus-visible uses a browser heuristic: during keyboard navigation the outline is visible, on a mouse click on a button it usually isn't. Never remove focus indication entirely.

  39. 39. What does tabindex="-1" do?

    Correct answer: Allows focus only programmatically (el.focus()), not via Tab

    tabindex="0" adds an element to the natural tab order, while -1 makes it focusable only via JS (e.g. a modal heading or a container when following an anchor). Positive values change the tab order and are considered an anti-pattern. To remove an element from interaction entirely, use the inert attribute.

  40. 40. When is aria-label justified?

    Correct answer: When an interactive element has no visible text, like an icon button

    aria-label sets an element's accessible name when there's no visible label: <button aria-label="Close">✕</button>. The first rule of ARIA is not to use it when a native option exists: alt for images, <label> for fields. aria-label doesn't affect SEO, and an unnecessary one can override clear visible text.

  41. 41. How do you apply an arbitrary value in Tailwind that isn't in the theme?

    Correct answer: w-[347px]

    Square brackets set an arbitrary value: w-[347px], bg-[#1da1f2], grid-cols-[1fr_2fr] (spaces become underscores). In v4, parentheses are shorthand for a CSS variable: w-(--sidebar-width) = width: var(--sidebar-width). If a value repeats often, move it into the theme.

  42. 42. Why can't you build a Tailwind class name like ` bg-${color}-500 `?

    Correct answer: The scanner only finds complete class names

    Tailwind doesn't run your code; it statically scans files for class-like tokens. The string bg-${color}-500 doesn't contain a complete name, so bg-red-500 isn't generated. The right way is mapping to full names: { red: "bg-red-500", blue: "bg-blue-500" }[color].

  43. 43. How do you add a custom brand color in Tailwind v4 so that bg-brand, text-brand, etc. work?

    Correct answer: Declare --color-brand inside @theme in CSS

    In v4 configuration moved into CSS: variables in @theme { --color-brand: oklch(...); } create both the utilities (bg-brand, border-brand) and a regular CSS variable var(--color-brand). The old tailwind.config.js is supported via @config but isn't needed by default.

  44. 44. What are group and peer for in Tailwind?

    Correct answer: For styling based on a parent's state (group-hover:) or a sibling's (peer-checked:)

    Put group on the parent and write group-hover:text-white on a descendant - the style applies when the parent is hovered. peer works for following siblings: <input class="peer"> + <p class="peer-invalid:visible">. Combining classes into one is @apply.

  45. 45. A React component merges external classes: className={"p-2 " + props.className}, and receives p-4. What padding results?

    Correct answer: It depends on rule order in the CSS, not in class

    Class order in the class attribute doesn't affect the cascade: with equal specificity, the rule that comes later in the CSS file wins. So the outcome of p-2 p-4 is unpredictable from the component's point of view. tailwind-merge (often via a cn() helper) removes conflicting classes and keeps the last one.

  46. 46. What is Tailwind's @apply directive for, and why shouldn't you overuse it?

    Correct answer: It inlines utilities into your own class

    .btn { @apply px-4 py-2 rounded; } is handy for styling third-party HTML or base elements. But rewriting a whole project with @apply gives you plain CSS with an extra abstraction layer and a bigger bundle. In Tailwind, reuse is usually solved with (React) components, not classes.

  47. 47. How do you accommodate users for whom animations cause discomfort?

    Correct answer: Use prefers-reduced-motion: reduce to simplify or disable animations

    Users can enable "reduce motion" in their OS (vestibular disorders, migraines). @media (prefers-reduced-motion: reduce) lets you replace parallax and large movements with gentle transitions. Tailwind has motion-reduce: and motion-safe: variants for this.

  48. 48. How do you build a two-column layout with a fixed-width sidebar and content filling the rest?

    Correct answer: display: grid; grid-template-columns: 250px 1fr

    250px 1fr - the first column is fixed, the second takes all the remaining space. 100% in the second column would overflow the container by 250px. The Flexbox equivalent: flex: 0 0 250px for the sidebar, flex: 1 for the content (and possibly min-width: 0).

  49. 49. Which image format usually gives the best compression for photos in modern browsers?

    Correct answer: AVIF or WebP, with a JPEG fallback if needed

    AVIF and WebP weigh noticeably less than JPEG at the same quality. Lossless PNG is for graphics with transparency and sharp edges, but it's huge for photos. BMP isn't compressed at all. SVG is better for icons and logos. Fallbacks are done with <picture> or automatically by a CDN/optimizer (e.g. next/image).

  50. 50. How do you properly include print-only styles?

    Correct answer: A media="print" attribute on <link> or an @media print block

    media="print" and @media print apply styles only when printing: hide navigation and ads, remove backgrounds, show link URLs via a::after { content: " (" attr(href) ")" }, control page breaks with break-inside: avoid. window.print() only opens the print dialog.

  51. 51. What is the specificity of :is(#hero, .card) p?

    Correct answer: (1, 0, 1) - it takes its most specific argument

    That is the key difference from :where(), which always contributes zero. :is(#hero, .card) p beats .card p even when the element only matched via .card.

  52. 52. What does aspect-ratio: 16 / 9 give you on a video container?

    Correct answer: The height follows the width, reserving space

    It replaced the old padding-top: 56.25% hack. Reserving space prevents layout shifts while iframes or images load.

  53. 53. What does inset: 0 mean on an absolutely positioned overlay?

    Correct answer: All four offsets are 0, covering the block

    inset is the shorthand for the four offsets and follows the same 1–4 value order as margin. Combined with position: absolute and a position: relative parent it creates a full overlay.

  54. 54. What does grid-auto-flow: dense do?

    Correct answer: Fills earlier gaps with later smaller items

    It is handy for galleries with items of different spans. Like order, it can break the correspondence between visual and keyboard order.

  55. 55. Why add flex-shrink: 0 to an icon inside a flex row with long text?

    Correct answer: So the icon isn't squeezed when space runs out

    Flex items shrink by default (flex-shrink: 1). Fixed-size elements like icons and avatars should opt out, while the text gets min-width: 0 to truncate.

  56. 56. How do you push the last item of a flex navbar to the far right?

    .nav { display: flex; }
    .nav .logout { margin-left: auto; }

    Correct answer: Give it margin-left: auto

    In flex layout auto margins take all remaining space in that direction. margin-inline-start: auto is the logical-property version that also works in RTL.

  57. 57. What does object-position: top do with object-fit: cover?

    Correct answer: Aligns the cropped image to the top

    object-fit decides how the image fills the box, object-position decides which part stays visible. The default is 50% 50%, the center.

  58. 58. What is @supports for?

    @supports (display: grid) {
      .layout { display: grid; }
    }

    Correct answer: Applying styles if a CSS feature is supported

    It checks feature support, not browsers. @supports selector(:has(a)) tests selectors too. Write a working fallback outside the block.

  59. 59. How do you follow the user's system dark theme in plain CSS?

    @media (prefers-color-scheme: dark) {
      :root { --bg: #111; --text: #eee; }
    }

    Correct answer: With the prefers-color-scheme media feature

    If the site also has a manual theme toggle, combine it with a class or data-theme attribute that takes priority over the media query.

  60. 60. What does color-scheme: light dark on :root do?

    Correct answer: Native controls and scrollbars follow the theme

    Without it, form fields and scrollbars stay light on a dark page. It doesn't recolor your own styles - that is still your CSS.

  61. 61. What is accent-color for?

    Correct answer: Tinting native checkboxes and range sliders

    It keeps native, accessible controls while matching the design - often enough instead of rebuilding a checkbox from scratch.

  62. 62. What does .field:focus-within match?

    Correct answer: .field when it or a descendant has focus

    It lets a wrapper highlight when its input is focused, or keeps a dropdown open while focus is inside it.

  63. 63. How do you change the color of list bullets without touching the text?

    li::marker { color: tomato; }

    Correct answer: With the ::marker pseudo-element

    ::marker supports a limited set of properties such as color, font-* and content. For fully custom bullets use list-style: none and ::before.

  64. 64. How can CSS number headings like "Step 1", "Step 2" automatically?

    .steps { counter-reset: step; }
    .steps h3::before {
      counter-increment: step;
      content: "Step " counter(step) ": ";
    }

    Correct answer: With CSS counters and counter()

    Counters update automatically when items are added or removed. Generated content in ::before isn't selectable and may not be announced consistently by screen readers, so don't put essential info there.

  65. 65. How do you truncate text to three lines with an ellipsis?

    .excerpt {
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;
      overflow: hidden;
    }

    Correct answer: With line-clamp, using -webkit- prefixes

    text-overflow: ellipsis works only for a single line (with white-space: nowrap and overflow: hidden). The prefixed line-clamp pattern is supported in all modern browsers.

  66. 66. Why is there a small gap under an <img> inside a <div>?

    Correct answer: Images are inline and sit on the text baseline

    The space below the baseline is reserved for letters like "g" and "y". Most CSS resets set img { display: block; } for this reason.

  67. 67. What does transform-origin change?

    .menu { transform: scale(0.95); transform-origin: top right; }

    Correct answer: The point around which rotations and scaling happen

    By default it is the center. A dropdown opening from a top-right button looks natural when it scales from top right.

  68. 68. Why is transition: all 0.3s considered a bad habit?

    Correct answer: It animates every property that changes

    List the properties explicitly (transition: transform 0.3s, opacity 0.3s). That keeps animations cheap and predictable.

  69. 69. Why add aria-hidden="true" to a decorative icon next to a button label?

    <button><svg aria-hidden="true">...</svg> Save</button>

    Correct answer: So screen readers skip the icon

    Never put aria-hidden on focusable elements - keyboard users would reach something that screen readers can't describe.

  70. 70. How do you make a screen reader announce "Saved" after an async action without moving focus?

    <div aria-live="polite">{{ statusMessage }}</div>

    Correct answer: Use a live region that exists before the update

    Screen readers watch live regions for changes. The region must already be in the DOM; inserting it together with the text is often missed. Use assertive only for urgent errors.

  71. 71. What is needed to make <div role="button"> behave like a real button?

    Correct answer: tabindex="0" plus Enter and Space handling

    ARIA changes what assistive tech announces, not behavior. A <button> is focusable, activates with keyboard and works with forms out of the box.

  72. 72. How do you hide a text label visually but keep it for screen readers?

    Correct answer: With a visually hidden (sr-only) class

    display: none and visibility: hidden remove the content from the accessibility tree. Tailwind's sr-only utility implements the clipping pattern.

  73. 73. What alt should an icon-only link to the home page have?

    <a href="/"><img src="logo.svg" alt="?" /></a>

    Correct answer: Text describing the destination, e.g. "Home"

    When an image is the only content of a link, its alt becomes the link's name. Describe what the link does, not what the image looks like.

  74. 74. How do you style an element based on a data-state attribute in Tailwind?

    <div data-state="open" class="data-[state=open]:bg-zinc-100">...</div>

    Correct answer: With the data-[...] variant

    Headless UI libraries (Radix, Headless UI) expose state via data-* and ARIA attributes, so data-[state=open]: and aria-expanded: variants style them without extra classes.

  75. 75. What does srcset="logo.png 1x, logo@2x.png 2x" do?

    Correct answer: Picks a sharper image on high-density screens

    Density (x) descriptors suit fixed-size images like logos. For images whose size depends on the layout, use width (w) descriptors with sizes.