Help CentreCommunityAnnouncements
We recently launched Your AdSense Page where you can find personalised information about your account to help you succeed with AdSense.
Ad units
How to modify your responsive ad code
Next: Guidelines for fixed-sized display ad units
If you find that our responsive ad code doesn't do everything you need, you may modify your ad code to better meet the requirements of your responsive site. The following examples show you how to correctly make these modifications.
Important:
If you're new to CSS media queries and modifying your ad code, we recommend you start with the Exact ad unit size per screen width example.
If you're already familiar with CSS media queries and modifying your ad code, feel free to go straight to the Examples of advanced responsive ad code features section.
Note: The examples described in this article are acceptable modifications of the AdSense ad code. You won't violate the AdSense programme policies by modifying your responsive ad code in these approved ways.
Exact ad unit size per screen-width example
This example shows you how to modify your responsive code to set specific ad unit sizes for three ranges of screen widths, i.e. mobile, tablet and desktop. You don't need to have any previous experience of CSS media queries or modifying AdSense ad code to follow this example.
Here's some modified responsive ad code that sets the following exact ad unit sizes per screen width:
For screen widths up to 500px: a 320x100 ad unit.
For screen widths between 500px and 799px: a 468x60 ad unit.
For screen widths of 800px and wider: a 728x90 ad unit.