Lighthouse 中的累积布局偏移报告的数字很高:0.546
分析跟踪我注意到图像块最初没有占用所需的空间并将下面的内容向下推。见图片:
我对此感到惊讶,因为图像元素的容器 div 具有最小高度设置:
CSS
div[itemprop="image"] {
display: inline-block;
float: left;
margin-right: 10px;
min-height: 400px;
}
#prodimage {
width: 100%;
max-width: 400px;
border: 1px solid #FFF;
}
HTML
<div itemprop="image" itemscope="" itemtype="http://schema.org/ImageObject">
<a href="#"><span itemprop="url" content="https://www.example./com/images/10055041.png"></span>
<picture><source type="image/webp" data-srcset="/images/10055041.webp" srcset="/images/10055041.webp">
<img id="prodimage" data-src="/images/10055041.png" src="/images/10055041.png">
</picture>
</a>
</div>