Skip to content

Conversation

@prakhar-pal
Copy link
Contributor

Description

This PR fixes a typo in the img documentation (the changed sentence contained duplicate more). I've also improved articulation of that sentence to read more naturally

Motivation

Mainly to fix the typo and additionally to improve concept's articulation.

Additional details

Related issues and pull requests

@prakhar-pal prakhar-pal requested a review from a team as a code owner November 20, 2025 23:25
@prakhar-pal prakhar-pal requested review from chrisdavidmills and removed request for a team November 20, 2025 23:25
@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed labels Nov 20, 2025
@prakhar-pal prakhar-pal changed the title fix typo and improved the sentence's articulation fix typo and improve articulation Nov 20, 2025
@github-actions
Copy link
Contributor

Preview URLs

Flaws (20)

URL: /en-US/docs/Web/HTML/Reference/Elements/img
Title: <img>: The Image Embed element
Flaw count: 20

  • macros:
    • Macro produces link /en-US/docs/Web/CSS/float which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/vertical-align which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/border which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/margin which is a redirect
    • Macro produces link /en-US/docs/Web/CSS/margin which is a redirect
    • and 15 more flaws omitted

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving this, @prakhar-pal. What you've done so far is good, but I have a further suggestion for you to consider.

- : Defers loading the image until it reaches a calculated distance from the viewport, as defined by the browser. The intent is to avoid the network and storage bandwidth needed to handle the image until it's reasonably certain that it will be needed. This generally improves the performance of the content in most typical use cases.

While explicit [`width`](#width) and [`height`](#height) attributes are recommended for all images to avoid layout shift, they are especially important for lazy-loaded ones. Lazy-loaded images will never be loaded if they do not intersect a visible part of an element, even if loading them would change that, because unloaded images have a `width` and `height` of `0`. It is also more a more disturbing user experience if the page reflows in the middle of reading.
While explicit [`width`](#width) and [`height`](#height) attributes are recommended for all images to avoid layout shift, they are especially important for lazy-loaded ones. Lazy-loaded images will never be loaded if they do not intersect a visible part of an element, even if loading them would change that, because unloaded images have a `width` and `height` of `0`. It also creates a more disruptive user experience when the page reflows in the middle of reading.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
While explicit [`width`](#width) and [`height`](#height) attributes are recommended for all images to avoid layout shift, they are especially important for lazy-loaded ones. Lazy-loaded images will never be loaded if they do not intersect a visible part of an element, even if loading them would change that, because unloaded images have a `width` and `height` of `0`. It also creates a more disruptive user experience when the page reflows in the middle of reading.
While explicit [`width`](#width) and [`height`](#height) attributes are recommended for all images to avoid layout shift, they are especially important for lazy-loaded ones. Lazy-loaded images will never be loaded if they do not intersect a visible part of an element, even if loading them would change that, because unloaded images have a `width` and `height` of `0`. It creates an even more disruptive user experience when the content visible in the viewport reflows in the middle of reading it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you've done so far is good, but I wonder if the sentence should be modified further to something like this. The page already mentions setting width/height to avoid layout shift, and that this is important, in a note inside the height description. So the existing text here seems a bit repetitive. I think it is supposed to say that the layout shift is particularly bad when you don't set width/height on lazy-loaded images because the shift can happen to the currently-visible content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants