HTML Frames

HTML Frames allow for multiple .html documents to be displayed inside of one browser window at a time. Frames are achieved by creating a frameset page, and defining each frame from within that page. When a frameset page is loaded, the browser automatically loads each of the pages associated with the frames. But frameset page doesn't actually contain any content - just a reference to each frame only.

html-frame

HTML Source Code :

main.html

menu.html


content.html

Frameborder and Framespacing

If you want a better look and feel, you can change the frameborder and framespacing between Frames. You can set these properties by changing the frameborder and framespacing attributes of Frameset.

Also you can set attributes of Frame to noresize and scrolling attributes.

How to load web pages in the content area of Frameset ?

frame-target

It is possible to load web pages in the content area of the frameset when you click on the menu links.

main.html

The above code we given the name to content area frame as "content".

menu.html

Here we add an extra tag in < head > part.

This is for loading the web pages into content area while clicking links on menu page.

content.html

content.html is same as above example.

When you run this frameset and click on W3C link, it will load w3c home page on your content area of frameset.

HTML Iframes

An iframe is used to display a web page within a web page.

You can specify width ,height and frameborder attributes to iframe.