Google News
logo
HTMl Frames
Frames allow you to split the browsers window up in to as many sections as you like, each capable of displaying its own document. Usually used for displaying a list of Contents (Links) on left side of the browser, which once clicked, display a document on the right side. When using frames, it's important you use the <!Doctype html public "-//wc3/dtd html 4.0 Final//en"> tag. As frames were only recognized by the w3c (world wide web consortium) as of version 4, the doctype tag ensures the file is correctly interpreted.

To use frames on a page we use <frameset> tag instead of <body> tag. The <frameset> tag defines how 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.



Example 1 :
<HTML>
<HEAD>
<TITLE>Simple frameset</TITLE>
    <FRAMESET cols="50%,50%">
        <FRAME border="1" name="frame1" src="#"></FRAME>
        <FRAME border="1" name="frame2" src="#"></FRAME>
    </FRAMESET>
</HEAD>
<BODY>
</BODY>
</HTML>
Output :
HTML Structure
Example 2 :
<HTML>
<HEAD>
<TITLE>Simple frameset</TITLE>
    <FRAMESET cols="30%,70%">
        <FRAMESET rows="50%,50%" >
        <FRAME frameborder="1" name="frame1" src="">
        </FRAME>
        <FRAME frameborder="1" name="frame2" src="">
        </FRAME>
        </FRAMESET>
        
        
        <FRAMESET rows="20%,80%">
        <FRAME frameborder="1" name="frame3" src="">
        </FRAME>
        <FRAME frameborder="1" name="frame4" src="">
        </FRAME>
    </FRAMESET>
</HEAD>
<BODY>
</BODY>
</HTML>
Output :
HTML Structure