About responsive ad units
Responsive web design allows you to dynamically control the presentation of your website according to the properties of the screen/device that it’s being viewed on. A responsive ad unit allows you to control the size of the ads on your page, in line with how you control the layout of the rest of your page across devices. For more information on multi-device web development, see Web Fundamentals on the Google Developers site.
Automatic sizing based on the space available. To make your code simpler and save you time and effort, our responsive ad code automatically adapts the ad unit size to your page layout. We calculate the required size dynamically based on the available space and the size of the user's display.
Support for ad size changes after a screen orientation change. If your responsive page changes its layout following a device orientation change (e.g., when a tablet or phone goes from portrait to landscape), we’ll request and load a new ad of the correct dimensions to fit the new page layout.Note:
- When we load a new ad following a device orientation change, we cache the original ad that was shown. If the device then returns to its previous orientation, we’ll show the original ad again rather than load another new ad.
- Refreshing the ads for device orientation changes creates additional ad requests, which may cause a slight decrease in RPM and CTR metrics. Be assured there’s no negative impact to your overall revenue.
- Full-width ads on mobile devices. Our experiments show that full-width responsive ads perform better on mobile devices in portrait mode. To help increase revenue, our responsive ad units automatically expand to use the full width of the user's screen when their device is orientated vertically.
- We only expand responsive ads when they’re likely to perform well and provide a good user experience.
- You can disable full-width responsive ads by adding a responsive ad tag parameter. Note that we don't recommend you do this as it could affect your potential earnings.
There are some situations in which you’ll need to take extra action to make a responsive ad unit work correctly:
- The parent container has no width set. If you place your responsive ad code within a parent container that doesn’t have an explicit width set, for example, within a floating element, then our ad code won’t be able to calculate the required size for the responsive ad unit. In this case, you’ll need to modify your code and use CSS media queries to set the size of the parent container. Find out how to modify your responsive ad unit.
- The parent container has fixed or limited height. Responsive ads should not be placed inside containers with a fixed or limited height, as they may be taller on some devices or browsers. If you need to limit the height of your responsive ads, you’ll need to modify your code and use CSS media queries to set the height of the parent container. Find out how to modify your responsive ad unit.
Additionally, you should be aware of the following:
- Mobile devices with poor connections. On mobile devices with poor connections you might see some browser reflow while our responsive ad code calculates the best standard height for the width of your parent container. Learn more about browser reflow.