How to Center an Iframe

Image Credit: Stockbyte/Stockbyte/Getty Images

Iframes are an HTML element that allows you to display another web page within the current page. The iframe element is usually placed in the center of a page. It has several properties, so you can format it according to the web page style. These format properties include the ability to center the iframe within the web page and center the file within the frame. Centering the frame involves adding the "align" property within the iframe HTML code and using a div tag to center it on the web page. Editing the HTML code can be done using a simple text editor like Notepad, or a more advanced console like Visual Studio.

Step 1

Open your HTML editor and load the file that has the iframe coded.

Step 2

Type "align=middle" into the HTML iframe code. The code below is an example of a centered iframe: