How can I center the output from some javascript?
On my site, I'm using the following advertising tag:
<script type='text/javascript'>
GA_googleFillSlot("Skyscraper");
</script>开发者_Go百科;
How can I get that "Skyscraper" to be centered, rather than range left (everything else in that zone is properly range left, but the skyscraper is narrower than the column, so I need it to center)?
I have no idea what that outputs, but you might be able to do...
<div style="margin: 0 auto">
<script type='text/javascript'>
GA_googleFillSlot("Skyscraper");
</script>
</div>
<div class="ad_container">
<script type='text/javascript'>
GA_googleFillSlot("Skyscraper");
</script>
</div>
and
.ad_container div {
text-align:center;
}
worked nicely as the Google ad has "display: inline-table;" on it.
Try with max-content
<div style="width: max-content; margin: 0 auto 0;">
<script type='text/javascript'>
GA_googleFillSlot("Skyscraper");
</script>
</div>
精彩评论