What is HTML Frames
The <frame> tag defines one particular window (frame) within a <frameset>.
Each <frame> in a <frameset> can have different attributes, such as border, scrolling, the ability to resize, etc.
With frames, you can display more than one HTML document in the same browser window.
Each HTML document is called a frame, and each frame is independent of the others.
The disadvantages of frames are
- The web developer must keep track of more HTML documents
- It is difficult to print the entire page
The HTML Frameset Element
The frameset element holds two or more frame elements. Each frame element holds a separate document.
The frameset element states only HOW MANY columns or rows there will be in the frameset.
The HTML Frame Element
The <frame> tag defines one particular window (frame) within a frameset.
In the example below we have a frameset with two columns.
The first column is set to 30% of the width of the browser window. The second column is set to 70% of the width of the browser window. The document "frame_a.htm" is put into the first column, and the document "frame_b.htm" is put into the second column:
<frameset cols="30%,70%"> <frame src="frame_a.html"></frame> <frame src="frame_b.html"></frame> </frameset>
Frameset and frame tag are removed in HTML5.
Iframe is a inline frame used to embedd other webpages within iframe. This can be used to embedded Youtube video, show google map , etc.
(How the HTML code above looks in a browser)
Target Iframe on Hyperlink
A hyperlink can open a webpage in iframe. To do this, name your irfame, and set target to hyperlink as iframe's name. If iframe name is frame1, hyperlink target should be frame1.
<iframe name="frame1" ></iframe> <a href="link1.html" target="frame1">Link 1</a> <a href="link2.html" target="frame1">Link 2</a> <a href="link3.html" target="frame1">Link 3</a> <a href="link4.html" target="frame1">Link 4</a>
Use Iframe to show location on Google Map
(Iframe is also used to play youtube video on your website using EMBED Code)