HTML Iframes

 

HTML iFrames

HTML iframes, also referred to as inline frames, will enable you to load another HTML document into a specific area within a web page.

There are many uses for an iframe, such as displaying advertising, as it provides a great way to give your advertisers more control over the ads they are displaying.

Iframes can also be used to display a form within your webpage. When your visitor fills out your form and clicks on the ‘Submit’ button, instead of leaving the page they’re on, the ‘thank you’ page will load within your iframe.

Another great use of an iframe is to display rotating content on your web page. For example, you could display products, testimonials, tips, images, or whatever you’d like.

Creating an iFrame

An iframe is created using the <iframe> tag and src element that specifies the document to be displayed within the frame.

HTML Code

HTML code viewed within an HTML document:
html-line

<iframe src="iframe_example.htm" width="200" height="200"> </iframe>

Browser View

HTML coding viewed through a web browser:
html-line

To specify the height and width of an iframe, add the width and height attributes.

 
This concludes the HTML iframes tutorial. In the next section, we will focus on HTML Meta Tags.