Archived topic
Banner Positioning to Center - Need help to update the code
7 replies · Started by Abdul on June 17, 2020
Created an element hook and placed the code. am able to see the code but it is not center aligned
Tried "center", "aligncenter", its not working
<div class="alignleft">
<script type="text/javascript">
amzn_assoc_ad_type = "banner";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_placement = "assoc_banner_placement_default";
amzn_assoc_campaigns = "amazonhomepage";
amzn_assoc_banner_type = "rotating";
amzn_assoc_p = "48";
amzn_assoc_width = "728";
amzn_assoc_height = "90";
amzn_assoc_tracking_id = "XXX";
amzn_assoc_linkid = "XXX";
</script>
<script src="//z-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&Operation=GetScript&ID=OneJS&WS=1"></script>
</div>
Hi there,
Try adding this CSS:
#amznBanners_assoc_banner_placement_default_0_img {
margin: auto;
}
It is not working. I added the code in the additional CSS and it is still in the same left aligned position
Added a center tag and it is working. trying to fit with the header container size but when i increase the width it again tries to align left. how to fit it to the header container ?
<center>
<iframe src="//rcm-na.amazon-adsystem.com/e/cm?o=1&p=48&l=ur1&category=amazonhomepage&f=ifr&linkID=d49dc17e8d25b8445cf65e28e00e59&t=testt-20&tracking_id=testt-20" width="1028" height="90" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>
</center>
thanks
You can do this:
<div class="grid-container banner-container">
<!-- your banner code here -->
</div>
And use this CSS to center it:
.banner-container {
text-align: center;
}
Not working, the banner is in the center now but not similar to the container above (header) it due which it now is in a separate container on its own which does not look good.
Moved the position to "After header content" now. I think this should be fine now as long as it is inside the container with the header and not hanging separately which does not look nice.
Glad to hear you found a solution