0

フルスクリーンの html5 ゲームで広告を中央に配置するにはどうすればよいですか? 私のゲームは、プレイ中にブラウザで全画面表示になるように設計されています。タブレット/PC/などで再生するかどうかに関係なく、広告を常に中央に配置したい.

では、広告を中央に配置するにはどうすればよいでしょうか。

これが私の広告コードです

<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>

これを試しましdocument.getElementById("goog").align = 'center';たが、うまくいきません。

4

1 に答える 1

1

あなたはこれを試すことができます

変化する<div id="goog" style="position:absolute; left:0; top:10;">

<div id="goog" style="position:absolute; left:50%; top:50%;margin-top:-125px;margin-left:-175px;width:350px;height:250px;">

また

<style>
    #goog { position:absolute; left:50%; top:50%;margin-top:-125px;margin-left:-175px;width:350px;height:250px; }
</style>

そしてhtml

<div id="goog">

于 2013-07-10T11:00:28.763 に答える