admin管理员组文章数量:1123089
I have an ad unit at the top of my site, on desktop views it fills with a 970x250 ad unit.
I have the ad unit injected inside a div that is 250px tall.
Here's some pseudo code showing the markup:
<body>
<aside class="top_ad_unit">
<div class="ad__desktop ad__window" data-ad='div-gpt-ad-flex'></div>
</aside>
<div>
..the rest of the site below...
CSS like so:
.top_ad_unit {
display: flex;
flex-flow: row nowrap;
justify-content: center;
background: #cdcdcd;
}
@media (min-width: 1120px) {
.top_ad_unit {
height: 250px;
}
}
And that CSS is inline as part of my critical path CSS.
So I'd think that the height of the div means that the ad won't cause any layout shift. The div is already there and already the correct height to encapsulate the ad, wether it loads fast, loads slow, or doesn't fill at all.
And that seems to be how it looks visually and when loading the page in Chrome's performance tab. But when I actually run the performance tab, it's showing this add as causing a layout shift and I'm baffled as to why.
Any insight would be appreciated! TY!
版权声明:本文标题:html - How can an iframe (ad) filling a div with an already defined height cause a layout shift - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736548269a1944478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论