.

iFrame HTML Basics


Reference Guide for basic HTML tags for iframes. IFrames are useful for a wide variety of content and especially for in-site navigation where you can use on to load pages or code snippets dynamically on a page without being an AJAX programmer and without using any javascript.
If you combine PHP with JavaScript you can do many things which almost look like AJAX - but are far simpler to implement as the only knowledge you would need is HTML and just a little bit of PHP for more advanced scripts.

Basic IFrame HTML

Bare minimum iframe code:

iframe code
  1. Opening tag
  2. iframe page source
  3. height of the iframe
  4. width of the iframe
  5. Non-iframe content (What to display in the users' browser if they are not capable of viewing iframes.)
  6. Closing tag 


Sample iFrame HTML

Below is a demonstration of two iframes. One with frameborders, and the other without. You can dynamically load different content by clicking on the two links below each frame. Page-2 is with a colored background so that you can easily see the boundaries of the iframe in the borderless example.
To direct a link to open inside of an iframe, the code is simple. You merely name the iframe, and then set the link as shown below. We have named our iframe "test". We then set the link to open in target="test".

Iframe with frameborders

Code:


Share This Post-

0 comments:

Post a Comment