Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Using iFrames
Your Ad Here

Using iFrames


Using iFramesInline Frames
The Iframe, or inline-frame, is a lot like a normal frame, except that it can be displayed anywhere, which makes it a useful (although irritating if overused) thing to know, it is also a very simple tag to use, with only 3 required properties.

How it works
Well, first of all you open the <iframe> tag, then you define which page you want to appear in the iframe, and how wide, and how tall you wish the iframe to be - the vast majority of people also set the frameborder attribute to 0 - so that it looks a lot better, here it is in action:



Now as you can see, I included a file, which shows the code for the iframe - note I set the frameborder to 1, so that it is clear where it is, here is the same iframe, except with the frameborder set to zero:



Now as you can see, this is a pretty nice way to include content from external files (similar to a PHP include) but what if you have a lot of content in your external file? well this is where iframes really come into their own - as long as you don't disable them (by setting scrolling="no") then iframes automatically add a scrollbar when the content overflows - so the iframe will stay the same size as you have set it to (in my case 550*30) - here it is in action:



All Together
Pretty nice eh - here's the code to make an iframe:

< iframe src="/img_articles/6117/ iframe_example.htm " width=" 600 " height=" 30 " frameborder=" 1 "></ iframe >

Now the default value for scrolling is auto, which will scroll if the content doesn't fit, if you definitely DO want scrollbars, set this to yes - if not, set it to no - and I would always recommend using frameborder="0", just because the frame borders are so ugly! Simply replace my iframe_example.htm with the file name of the page you want to include, the set the width and height accordingly, and you're ready to go!

Conclusion
You can now use iframes in your web design, and change the scrollbars, borders, width and height.

I hope this came in useful!

Author's URL: Infinite-fire.net
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

HTML is Hyper Text Markup Language that is used to make hypermedia and hypertext documents for the Web. More HTML and CSS: Most Popular Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Add comments to "Using iFrames"

Only registered users can write comment

No comments yet...