• Around The HomeToggle Menu

    • Entertainment
    • Productivity
    • Smart Home
  • FamilyToggle Menu

    • Parenting
    • Toys
    • Pets
    • Travel
  • Product ReviewsToggle Menu

    • Phones
    • Tablets
    • Laptops
    • Desktops
    • Wearables
    • Audio
    • Cameras
    • Headphones
    • Printers
    • Smart Home
    • TVs
    • Gaming and Video
  • One Cool ThingToggle Menu

    • Frugal Tech
    • Kickstarters
    • Videos
Techwalla
  1. Home
  2. Around The Home
  3. Productivity
  4. How to Center an Iframe

How to Center an Iframe

March 31, 2015
By: Lysis
  • Share
  • Share on Facebook

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.

Video of the Day

Code
credit: Stockbyte/Stockbyte/Getty Images

Step

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

Step

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

Step

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.

Show Comments

Related Articles

How to Use Javascript to Play an MP3 File

How to Use Javascript to Play an MP3 File

Around The Home
Productivity
By: Michael Carroll
How to Embed Flv Video in HTML

How to Embed Flv Video in HTML

Around The Home
Productivity
By: Brandy Alexander
How to Center Worksheets Both Horizontally & Vertically in Excel

How to Center Worksheets Both Horizontally & Vertically in Excel

Around The Home
Productivity
By: David Weedmark
How to Create an .Xml File

How to Create an .Xml File

Around The Home
Productivity
By: Darla Ferrara
HTML Coding to Change the Width of a Paragraph

HTML Coding to Change the Width of a Paragraph

Around The Home
Productivity
By: Steve McDonnell
How to Make a Static Web Page

How to Make a Static Web Page

Around The Home
Productivity
By: Alex Smith
  • HOW WE SCORE
  • ABOUT US
  • CONTACT US
  • TERMS
  • PRIVACY POLICY
  • COPYRIGHT POLICY
  • Advertise

An error occurred. Try again later.

Thanks for signing up!
© 2018 Leaf Group Ltd. Leaf Group Media

Get great tech advice delivered to your inbox.

Keep your family productive, connected, entertained, and safe.

Please enter a valid email.