By default, when you add an ad unit to your website, it will be left-aligned. To center your ad unit on the page, you can wrap your ad code with a <div>
that uses CSS Flexbox to center its contents. Follow the steps below:
<div style="display:flex;justify-content:center;"> <!-- AD CODE GOES HERE --> </div>
Replace <!-- AD CODE GOES HERE -->
with your actual ad code.
Here is an example of how your final code might look:
<div style="display:flex;justify-content:center;"> <div id='div-gpt-ad-1602686592219-0' style='width: 300px; height: 250px;'> <script> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1602686592219-0'); }); </script> </div> </div>
This will ensure your ad unit is centered on the page.