How can I center an iFrame on my webpage?

How can I center an iFrame on my webpage?

geo07
Tourist
9 1 0

Hello! I am trying to center this iFrame, but no matter what I try it is stuck to the left side. Any help would be greatly appreciated. Thank you!

 

<div style="position: relative; width: 75%; height: 0; padding-top: 82.357275%; padding-bottom: 0; box-shadow: 0 2px 8px 0 rgba(63,69,81,0.16); margin-top: 1.6em; margin-bottom: 0.9em; overflow: hidden; border-radius: 8px; will-change: transform; align-items: center;
    margin: auto;"><iframe loading="lazy" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; border: none; padding: 0; margin: 0 auto; display: block; border-style: none;" src="https://www.canva.com/design/DAF5Cx0xHbo/view?embed" allowfullscreen="allowfullscreen" allow="fullscreen">
  </iframe></div>
<a href="https://www.canva.com/design/DAF5Cx0xHbo/view?utm_content=DAF5Cx0xHbo&amp;utm_campaign=designshare&amp;utm_medium=embeds&amp;utm_source=link" target="_blank"></a>
Reply 1 (1)

Himanshu7
Shopify Partner
17 0 0

Hi,

 

Please check this code and it will resolve your issue.

https://codeshare.io/9bpRAV

HP