We can’t do this without you! Help us stay online and support free content.  Click to Donate

Fill in the blank: Adding width and height attributes to ima

Fill in the blank: Adding width and height attributes to images helps reduce _________________.

Question: Fill in the blank: Adding width and height attributes to images helps reduce _________________.

  • First Input Delay
  • Total Blocking Time
  • Cumulative Layout Shift
  • Time to Interactive

Explanation

Explicit image dimensions let the browser reserve layout space before the file finishes loading. That prevents nearby elements from shifting position as rendering continues, which is the core behavior measured by Cumulative Layout Shift. HubSpot’s performance guidance specifically recommends adding width and height attributes on img elements for this reason. It also notes that predefined dimensions help the browser optimize layout stability during render time. (developers.hubspot.com)

Why the other options are incorrect

First Input Delay measures delay before the browser responds to a user’s first interaction, so it is about input responsiveness rather than visual instability. (developers.hubspot.com)

Total Blocking Time measures how long the main thread is blocked by tasks, so it is tied to execution delays rather than content shifting on the page. (developers.hubspot.com)

Time to Interactive measures when a page becomes reliably usable for interaction, so it does not describe movement caused by late image sizing. (developers.hubspot.com)

Source for verification

https://developers.hubspot.com/docs/cms/best-practices/testing-staging-performance/speed

The answer(s) to the question is highlighted in the BOLD text above. You can also find more questions and answers related to the exams on the "HubSpot CMS for Developers II" page.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top