How to Center an Iframe
- 1). Open your HTML editor and load the file that has the iframe coded.
- 2). Type "align=middle" into the HTML iframe code. The code below is an example of a centered iframe:
<iframe src="my_file.html" align="middle">
This code centers the internal page within the iframe. - 3). Use a div tag to center the iframe within the web page. The code below encapsulates the iframe and centers it on your web page.
<div align="center"><iframe src="my_file.html" align="middle"></div> - 4). Save the page. Use your web browser to test the new settings. Open the page in a web browser and view the iframe location. It's now centered on the page.