Open In App

HTML | <frame> Tag

HTML Frames are used to divide the web browser window into multiple sections where each section can be loaded separately. A frameset tag is the collection of frames in the browser window.

Creating Frames: Instead of using body tag, use frameset tag in HTML to use frames in web browser. But this Tag is deprecated in HTML 5. The frameset tag is used to define how to divide the browser. Each frame is indicated by frame tag and it basically defines which HTML document shall open into the frame. To define the horizontal frames use row attribute of frame tag in HTML document and to define the vertical frames use col attribute of frame tag in HTML document.



Example:




<!DOCTYPE html>
<html>
    <head>
        <title>Example of HTML Frames using row attribute</title>
    </head>
          
    <frameset rows = "20%, 60%, 20%">
        <frame name = "top" src
        "C:/Users/dharam/Desktop/attr1.png" />
        <frame name = "main" src
        "C:/Users/dharam/Desktop/gradient3.png" />
        <frame name = "bottom" src
        "C:/Users/dharam/Desktop/col_last.png" />
        <noframes>
            <body>The browser you are working does 
                        not support frames.</body>
        </noframes>
    </frameset>
</html>                    

Output: The above example basically used to create three horizontal frames: top, middle and bottom using row attribute of frameset tag and the noframe tag is used for those browser who doesn’t support noframe.



Example: This example illustrates the col attribute of frameset tag.




<!DOCTYPE html>
<html>    
    <head>
        <title>Example of HTML Frames Using col Attribute</title>
    </head>
          
    <frameset cols = "30%, 40%, 30%">
        <frame name = "top" src
        "C:/Users/dharam/Desktop/attr1.png" />
        <frame name = "main" src
        "C:/Users/dharam/Desktop/gradient3.png" />
        <frame name = "bottom" src
        "C:/Users/dharam/Desktop/col_last.png" />        
        <noframes>
            <body>The browser you are working does 
                         not support frames.</body>
        </noframes>
    </frameset>
</html>                    

Output: The above example basically used to create three vertical frames: left, center and right using col attribute of frameset tag.

Attributes of Frameset tag:

Article Tags :