Which element is measured by LCP in the first screen time, and why are image sites prone to measurement bias?
The LCP measures the time it takes for the **image or text block** within the viewport to complete rendering, counting from the start of the page load. Therefore, it does not measure whether 'content on the first screen has appeared', but rather 'when the large content block on the first screen is actually rendered'. Websites that are image-heavy are prone to misjudgment, the reason being the rules for determining candidate elements: background images, video covers, and lazy-loaded images can change who the **element** is, and may even push it to be rendered last.
Which elements will enter the candidate list
The elements involved in the judgment include ordinary images, embedded vector graphics, video cover frames, images loaded as background styles, and blocks composed of text nodes. The judgment is based on the rendered area, not the position written in the code. This leads to three typical types of deviations.
**Class is background image deviation. The large image on the first screen, if loaded using the style background method, is discovered by the browser later than the image tag in the document: it needs to parse the style, then initiate the request, and then decode and render. For the same number of bytes, the image loaded via the background method often appears on the screen later than the image loaded via the tag method, and it is also a large element on the first screen, directly becoming a candidate for LCP.
The second type is the lazy loading bias. Adding a delay to the first screen image is equivalent to telling the browser not to fetch it. The strategy of loading only when scrolling into the viewport is beneficial for long lists, but it has a negative effect on the main image of the first screen - the delay loading pushes the **element** to after interaction, and the time measured naturally deviates.
The third type is the aperture shift caused by placeholder and real image alternation. On a page with blurred placeholder or skeleton screen, the placeholder is drawn first, followed by the real image, and the **current element** will change between the two drawings. The difference in sampling points can be very large, which is also a common reason why the results of the same page are not aligned in different testing tools.
Why is the bias measurement of the image station more concentrated
The three features of an image station are all hit simultaneously: many single-page images, large size, and layout relies on style control. This is particularly obvious on list pages, where the **elements** in the thumbnail matrix depend on the current viewport size. The candidates for desktop and mobile may be completely different, and the time measured on both ends is not comparable.
There is a type of deviation coming from the text layer. The layout of the title pressing on the image, if the font needs to be downloaded separately, the rendering of the text block will be later than the background image, at this time, whether it is the image or the text block for **content rendering depends on the area comparison. When encountering such pages, a more stable approach is to look at the identifier of the rendering element rather than just the total time to determine which part needs to be optimized.
What can server-side rendering and automatic image matching change?
The technical stack of AnQiCMS is Go language with Iris framework and GORM, the page is assembled on the server and returned, the official stance is that the page loading speed is significantly improved compared to traditional PHP CMS. For LCP, the practical significance of server-side rendering lies in the determination of the structure of the first screen: the document is returned with the label and size information of the main image, so the browser does not have to wait for the script to be executed to know which image to fetch. In the case of dynamically assembled pages, the situation is reversed - when the image is injected by the script, the opportunity to enter the candidate is delayed, and the measured time includes the script execution section.
The title auto-assigns images affecting the other end: images are distributed by the system based on the title content. When the size of the assigned image is too large or not pre-generated in the appropriate specifications, the first screen directly bears the volume of the original image; conversely, if the image allocation process provides the size that is already adapted, the number of bytes on the first screen will decrease significantly. Aligning the image allocation process with the display size is a step that makes the image station more cost-effective.
Optimize the order first, confirm the candidate elements, and then decide which ones to move: change the main screen image to the document tag, remove the lazy loading on the main image, replace the background image with preloading, and write explicit width and height on the images to avoid area jitter. After completing these four steps, discuss volume compression, otherwise, it is easy to waste effort on elements that are not candidates.
Common questions
Question: If there is no image on the first screen, but the LCP is short, is it possible?
Answer: Possible. Text blocks also participate in the judgment. When the page first renders a large area of text, the candidate is the text block, which is unrelated to the image.
Question: Should lazy loading be turned on for the entire site?
Answer: Do not cut all at once. The main image on the first screen is not suitable for lazy loading, the thumbnails below the long list are more suitable; the demarcation line is generally taken after the content of the first screen.
Question: The numerical difference between mobile and desktop is very large, which one should be changed?
Answer: Modify each candidate element separately. The two ends **elements** are often not the same block, and it is easy to change the wrong object when using a set of optimizations to cover both ends.