How Do I Center An Ad Unit On A Page?

How Do I Center An Ad Unit On A Page?

This article relates to Google Ad Manager HTML Ad Tag Code

When implementing Ad Unit code to your website, the default is to left align that ad unit. You can center your ad unit by wrapping your ad code with the following code:

  1. <div style="display:flex;justify-content:center;">
  2.   <!-- AD CODE GOES HERE -->
  3. </div>

The end result will look something like this:

  1. <div style="display:flex;justify-content:center;">
  2.   <div id='div-gpt-ad-1602686592219-0' style='width: 300px; height: 250px;'>
  3.     <script>
  4.       googletag.cmd.push(function() { googletag.display('div-gpt-ad-1602686592219-0'); });
  5.     </script>
  6.   </div>
  7. </div>

    • Related Articles

    • How Do I Add A Clickable PDF To A Page?

      This Article Is For: All users who have access to: Pages This is applicable to: All themes These are the instructions for adding a clickable PDF to a page, blog etc Step-by-step guide Upload your PDF to the SoCast media library After it has been ...
    • Can I Set Up An Ad Campaign To Appear Only With A Specific Blog Category?

      This guide will help SoCast Engage users target ads on their website based on the blog post category. For example, if a user visits a blog for the morning show, you can display ads sponsoring the morning show. Step 1: Add the "Ad Setup Code" Before ...
    • Full Page Ad Slot Element

      This Article Is For: All users who have access to one/all of the following: pages, contests, and sidebars This is applicable to: SoCast 3.0 Theme Requirements: Must already have a Google Ad Manager account (or a similar ad manager, approved by ...
    • How Do I Create Responsive Ad Units for my Website?

      This article is for users with the following permissions: Manage Website Settings Manage Advertising Settings Access to Google Ad Manager This article is based on using Google Ad Manager for ad serving. If you do not have Google Ad Manager you can ...
    • Can I Add Custom Ads To A Page Or Sidebar?

      This Article Is For: All users who have the 'Access Sidebar' permission This is applicable to all SoCast Themes Requirements: Users must have admin access to Google DFP To do this, use the Custom HTML widget to place the ad code you've generated. DO ...