Posted on Sep 8th, 2009 in
HTML Tutorials |
0 comments
In the previous tutorial we learned the concept of frames. In this tutorial we will be introduced to the iframe tag. The concept is somewhat similar to that of frames, the difference being we are displaying another document within our web page.
Let’s work on this example. Copy and Paste the following:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=iso-8859-1″ />
<title>iframes</title>
</head>
<body><p>Checkout Learn HTML Online</p>
<iframe src=”http://www.learnhtmlonline.com” style=”width:800px; height:400px”>
<p>Sorry but your browser doesn’t support iframes.</p>
</iframe>
</body>
</html>
Save this file as iframes.htm, and open it in your browser.
When you open this page in your browser, you should see “Checkout Learn HTML Online”. Beneath that line should be your iframe (inline frame) displaying the actual website of LearnHTMLOnline.com.
Understanding The Code
Our lines of code that we are concerned about is:
<iframe src=”http://www.learnhtmlonline.com” style=”width:800px; height:400px”>
<p>Sorry but your browser doesn’t support iframes.</p>
</iframe>
We define the iframe with the <iframe> tag. It’s main attribute, src=”http://www.learnhtmlonline.com”. The src is the web page we want our iframe to display. The width and height simply define the size of our iframe within the web page.
The message, “<p>Sorry but your browser doesn’t support iframes.</p>” is simply a generic output message for browsers that don’t support iframes. Most modern browsers do support iframes.
Final Word
As you can see, there really isn’t much to iframes. You simply define the website you want to display, and then choose the size. If you have to use frames on your website, iframes is another option that you can use. When you want to display the content directly from another site, you will most likely use iframes.
Source: learnhtmlonline.com
you may also like:
- HTML Tutorial – Build a Neat HTML5 Powered Contact Form
Tutorial Details
Requirements: PHP 4.3+
Technologies Used: HTML5, Javascript, jQuery, AJAX & PHP
Difficulty: Beginner - Intermediate
Estimated Completion Time: 60 Minutes
Step 1: Ge... - HTML Tutorial – 28 HTML5 Features, Tips, and Techniques you Must Know
1. New Doctype
Still using that pesky, impossible-to-memorize XHTML doctype?
view plaincopy to clipboardprint?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http... - HTML Tutorial – 6 Ways To Improve Your Web Typography
Introduction
Typography is the art of designing letters, words, paragraphs, and how they interact with each other. Many designers and developers often equate typography with choosing a font or typefa... - HTML Tutorial – CSS3 Spinning Social Media Icons
The HTML
First we start off with our social media icons.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="spinning_icons">
<a href="http://www.twitter.com/... - HTML Tutorial – Quick tip coding beautiful form
What will be needed in this tutorial?
PSD file from preview tutorial
Museo Slab font
Step 1. Folder and files structure
First create Your folder structure. We will need index.html, style.css...
Leave a Reply