Ways to Center an iFrame

Last Updated On Tuesday 22nd Mar 2022

Inline Frame or iFrame simply put a window on a webPage for looking a other piece of online content.

centering an iframe HTML Element

	<iframe src="https://codejagd.com/"></iframe>
	

iFrame Element

	<div>
    <iframe src="https://codepen.io" title="CodePen">
    </iframe>
</div>
	

to make center iframe

	div {
  text-align:center;
}
	

UseCases

  • To Display third Party Content on Your Site
  • Ads – Many Siedbar and banner ads are iFrames
  • Youtube Videos
  • Social Media Posts and much more