Attributes of Frame Tag

name: This attribute is used to give names to the frame. It differentiate one frame from another. It is also used to indicate which frame a document should loaded into. Example:

 <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" />
Here we use three frames with names as left center and right.

src: This attribute in frame tag is basically used to define the source file that should be loaded into the frame.The value of src can be any url. Example:

<frame name = "left" src = "/html/left.htm" />
In the above example name of frame is left and source file will be loaded from “/html/left.htm” in frame.

marginwidth: This attribute in frame tag is used to specify width of the spaces in pixels between the border and contents of left and right frame. Example:

<frame marginwidth="20">

marginheight: This attribute in frame tag is used to specify height of the spaces in pixels between the border and contents of top and bottom frame. Example:

<frame marginheight="20">

scrollbar: To control the appearance of scroll bar in frame use scrollbar attribute in frame tag. This is basically used to control the appearance of scrollbar. The value of this attribute can be yes, no, auto. Where the value no denotes there will be no appearance of scroll bar. Example:

<frame scrollbar="no">

HTML | Tag

HTML Frames are a powerful tool for dividing your web browser window into multiple sections, each capable of loading content independently. This is achieved using a collection of frames within a frameset tag. However, it’s important to note that the <frame> tag is deprecated in HTML 5.

Creating Frames:

Creating frames in HTML involves using the <frameset> tag instead of the <body> tag. Each frame is defined by the <frame> tag, which specifies the HTML document to be loaded into the frame. The row attribute is used to define horizontal frames, while the col attribute is used for vertical frames. Here’s an example of how to create three horizontal frames using the row attribute of the frameset tag.

Example:

html
<!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.

html
<!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:

cols: The cols attribute is used to create vertical frames in web browser. This attribute is basically used to define the no of columns and its size inside the frameset tag. The size or width of the column is set in the frameset in the following ways:

Use absolute value in pixel Example:

<frameset cols = "300, 400, 300">

Use percentage value Example:

<frameset cols = "30%, 40%, 30%">

Use wild card values: Example:

<frameset cols = "30%, *, 30%">
In the above example * will take the remaining percentage for creating vertical frame.

rows: The rows attribute is used to create horizontal frames in web browser. This attribute is used to define no of rows and its size inside the frameset tag. The size of rows or height of each row use the following ways:

Similar Reads

Use absolute value in pixel

Example:...

Attributes of Frame Tag:

name: This attribute is used to give names to the frame. It differentiate one frame from another. It is also used to indicate which frame a document should loaded into. Example:...

Advantages of Frame Tag:

It allows the user to view multiple documents within a single Web page.It load pages from different servers in a single frameset.The older browsers that do not support frames can be addressed using the tag....

Conclusion

Despite the  tag being deprecated in HTML 5, understanding how it works can provide valuable insight into the evolution of web development. Today, similar results can be achieved using CSS and other modern techniques. Always remember to keep your web development skills up-to-date and adaptable to the ever-changing landscape of the web....

Contact Us