Skip to content

Commit 8f180fc

Browse files
committed
Update CSS with absolute position to remove the CLS
1 parent 4cfa0bd commit 8f180fc

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

dotcom-rendering/src/components/AdSlot.web.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,19 @@ const topAboveNavContainerVariantStyles = css`
128128
&[top-above-nav-ad-rendered='true'] {
129129
min-height: auto;
130130
}
131-
`;
132131
133-
const topAboveNavBackgroundVariantStyles = css`
134-
.ad-slot--top-above-nav:not([data-google-query-id]) {
135-
margin: 24px auto 0;
136-
height: 250px;
137-
width: 970px;
138-
background-color: ${palette.neutral[93]};
132+
/* Ad placeholder grey box rendered while loading the ad */
133+
&:not([top-above-nav-ad-rendered='true']) {
134+
::before {
135+
content: '';
136+
position: absolute;
137+
height: 250px;
138+
width: 970px;
139+
top: ${labelHeight}px;
140+
left: 50%;
141+
transform: translateX(-50%);
142+
background-color: ${palette.neutral[93]};
143+
}
139144
}
140145
`;
141146

@@ -609,10 +614,7 @@ export const AdSlot = ({
609614
<AdSlotWrapper
610615
css={
611616
isIn250ReservationVariant
612-
? [
613-
topAboveNavContainerVariantStyles,
614-
topAboveNavBackgroundVariantStyles,
615-
]
617+
? topAboveNavContainerVariantStyles
616618
: topAboveNavContainerStyles
617619
}
618620
>

0 commit comments

Comments
 (0)