HTML <frame> Tag
The HTML <frame> Tag is not supported in HTML5. It was used to specify an area in an HTML file to display another HTML web page within it. A web page is thus divided into multiple sections or frames. Different web pages are present in each frame. It is used with the HTML <frameset> tag. Nowadays, the HTML <iframe> or <div> tag can be used with CSS to get similar effects.
Syntax:
Tag Specific Attributes
Example 1:
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <frameset cols="25%,50%,25%"> <frame src="frame1.html" > <frame src="frame2.html"> <frame src="frame3.html"> </frameset> </html>
Frame1.html:
<!DOCTYPE html> <html> <head> <style> div{ background-color:crimson; height: 400px; } </style> </head> <body> <div style = "text-align: center; padding: 30px; color:white;"> <h2>HELLO WORLD!!</h2> <p>I am the FIRST Frame.</p> </div> </body> </html>
Frame2.html:
<!DOCTYPE html> <html> <head> <style> div{ background-color:gray; height: 400px; } </style> </head> <body> <div style = "text-align: center; padding: 30px; color:black;"> <h2>HELLO WORLD!!</h2> <p>I am the SECOND Frame.</p> </div> </body> </html>
Frame3.html:
<!DOCTYPE html> <html> <head> <style> div{ background-color:black; height: 400px; } </style> </head> <body> <div style = "text-align: center; padding: 30px; color:white;"> <h2>HELLO WORLD!!</h2> <p>I am the THIRD Frame.</p> </div> </body> </html>
Explanation:
In the above example, we are using the HTML <frame> tag to create 3 vertical HTML frames within an HTML web page.
Example 2: Creating Horizontal frames.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <frameset rows="25%,50%,25%"> <frame src="frame1.html" > <frame src="frame2.html"> <frame src="frame3.html"> </frameset> </html>
Explanation:
In the above example, we are using the HTML <frame> tag to create 3 horizontal HTML frames within an HTML web page.
Supporting Browsers:
Chrome, IE, Firefox, Opera, and Safari.