HTML - Frames
What are Frames in HTML?
HTML frames are often used to separate your browser window into multiple sections where each section can be responsible for displaying and loading a separate HTML document. a set of frames within the browser window is understood as a frameset. The window is split into frames in quite a similar way then the tables are organized into:
1. rows
2. columns.
Disadvantages of Frames
There are few cons with using frames, so it is really never recommendable to make use of frames in your webpages:
1. Some smaller devices cannot deal with frames actually because their screen isn't large enough to be divided.
2. Sometimes your page is going to be displayed differently on different computers thanks to different screen resolutions.
3. The browser's back button won't work as the user expects.
4. There are still a couple of browsers that don't support frame technology.
Creating Frames
To use frames on a page we use <frameset> tag rather than <body> tag. The <frameset> tag defines, the way to divide the window into frames. The rows attribute of <frameset> tag defines horizontal frames and cols attribute defines vertical frames. Each frame is indicated by <frame> tag and it defines which HTML document shall open into the frame.
Note − The <frame> tag deprecated in HTML5. Do not make use of this element.
Example
The following is an example of how to create three horizontal frames:
<!DOCTYPE html> <html> <head> <title>HTML Frames</title> </head> <frameset rows = "10%,80%,10%"> <frame name = "top" src = "/html/top_frame.htm" /> <frame name = "main" src = "/html/main_frame.htm" /> <frame name = "bottom" src = "/html/bottom_frame.htm" /> <noframes> <body>Your browser does not support frames.</body> </noframes> </frameset> </html>