Home / HTML And CSS / Google remarketing tag iframe height issue

Google remarketing tag iframe height issue

Google’s remarketing code inserts an iframe (with no content) directly below the opening <body> tag, which is 300x13px and can throw out a website’s layout. This post looks at how to effectively hide it with CSS in a couple of different ways that hopefully shouldn’t mess with its functionality at all.

Using position: absolute

Add this to your CSS and it will use absolute positioning, pushing it off the left side of page so it cannot be seen and doesn’t affect content flow:

iframe[name='google_conversion_frame'] {
    position: absolute;
    left: -1000px;

Setting the height

Another method is to set the height instead:

iframe[name='google_conversion_frame'] {
    height: 0;

I’ve seen posts that suggest setting display: block as well, but just setting the height seems to work OK. If you find it’s not setting the hide in a particular browser, then try adding display block too.

Setting display: none?

This will work to hide the frame, but it’s probably not a good idea because it may mess with the functionality of the remarketing code. Obviously the above options may too, but something needs to be done to prevent it from pushing layouts out.