I am struggling to find a way to perfectly center my advertisement in a fullscreen HTML5 game. The game automatically expands to fullscreen when played, and I want the advertisement to always be positioned in the center, regardless of whether the game is being played on a tablet or a PC.
So, how can I achieve this centered placement for my advertisement?
Below is the code for my advertisement:
<div id="goog" style="position:absolute; left:0; top:10;">
<script type="text/javascript">
<!--
google_ad_client = "ca-pub-xxxxxxxxx";
google_ad_slot = "xxxxxxxx";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
I have attempted to use
document.getElementById("goog").align = 'center';
, but unfortunately, it did not work as expected.