How can I center an iFrame on my webpage?

Topic summary

A user is struggling to center an iframe element that remains stuck on the left side of their webpage despite attempts to fix it.

Code provided:

  • The iframe is wrapped in a <div> with position: relative and width: 75%
  • Styling includes align-items: center and margin: auto
  • The code snippet appears corrupted or reversed in the original post

Solution offered:
Another user provided a CodeShare link containing corrected code to resolve the centering issue.

Status: The problem appears resolved with the shared code solution, though the specific fix details aren’t visible in the discussion text itself.

Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

Hi,

Please check this code and it will resolve your issue.

https://codeshare.io/9bpRAV