Iframes

Creating an iframe

To create an iframe use the code below.

<iframe src="page.html" frameborder="0" height="100" width="100" id="iframe1" scrolling="no"></iframe>

The example above shows the main attributes needed when using an iframe .The src is the location of the page you want to display. The frame boarder can hold a value of 0 or 1 and displays a border around the edge of the iframe. The height and width sets the size of the iframe. The scrolling attribute has a value yes, no or auto and determines whether the scrollbars are visible or not.

Linking to iframes

To make a page open in an iframe give the iframe a name and id as this this will act as the target. For example an iframe called “news” could have a page loaded in it by making the link target “news”.

<iframe src="page.htm" frameborder="0" height="100" width="100" id="iframe1" name="iframe1" scrolling="no"></iframe>
<a href="newpage.htm"target="iframe1">Link to iframe</a>

Categories

Tags

No tags

Social