HTML Div Tag and frame set tag with example and video tutorials – learn html in Hindi:
Both the tags are used to divide the browser into portions but nowadays people prefer to use div more instead of frameset. Now i will describe the difference between div tag and frameset in html. Html table tag is also same as Div Tag and frameset tag, but its difficult to add multiple pages into one table that’s why we use div tag or framset tag in html.
Div tag contains other elements of HTML in same windows. A div is a generic container element for grouping and styling. This tag element is very often used together with CSS, to layout a web page and Browsers always place a line break before and after the div tag.
Frame contains other site pages or another page inside the existing page. It acts as a child page to main page. Frame creates divisions within a web page and should be used within the frameset tag. And each html documents or browser will call as a frame, all frames are independent.
The disadvantages of using frames are:
• Frames are not going to support in future versions of HTML
• Frames are difficult to use as compared to div tag.
Avoid using frame tag unless you don’t care for allowing users to bookmark your page or search engine rankings in website. Now I am going to explain about uses of div and frameset tag in html:
Frameset in HTML:
As above mentioned frameset is combination of multiple browsers in single browser or we called frame also. For creating frameset we use <frameset > tag for opening and closing the frames and write the columns or rows which we want to divide in what ratio also. Now inside this frameset tag we add frames or divide the browser as per our requirement.
For Example I want to divide browser into 3 rows using frameset then first I have to create 3 pages which we want to show inside the frameset then write code like this:
<frame name=”left” src=”a.html” />
<frame name=”center” src=”b.html” />
<frame name=”right” src=”c.html” />
Here you can see I have created 3 pages named as a.html, b.html, c.html first. Then created frameset with value of rows and assigned the ratio which I want to show in frames like: 20%, 50%, 30%.
Inside the frameset tag I use frame tag to add pages inside frameset and used src tag to locate the page address also used name tag to assign where I want to show the pages and then closed with frameset tag. Please copy the code and save in notepad file then run, You will see this output: Please copy the code and save in notepad file then run, Now You will see the output like this:
Div Tag Program:
If you want to do the same thing using div tag then here you don’t need to create pages. Here you just need to write div tag when you want to divide the page and close the div tag. You can see the example of div tag with code below:
<head> <title> Div Tag </title> </head>
<div> Header </div>
<h1> this is a body </h1>
Hello I am a developer, working as a senior developer in Amison Group – a it
Company in Chhattisgarh. You can learn html from me
<div> Footer </div>
Here you can see inside the body tag I used 3 times div tag so this will divide page into 3 parts. And I used hr tag to create line so that you understand this properly. Please copy the code and save in notepad file then run, you will see this output:
I hope you understood how to use div tag in html, Like this you can divide the browser into your required format. Or you can also watch this video to understand more about div tag and frameset in html:
Its my suggestion to all of you, please use div tag instead of frameset because frameset is now not supported by some browsers and you cannot develop beautiful website using website. Creating website using html is easy, with the help of div tag you can create beautiful attractive website in html easily. If you have any problem on this then please comment below and also give your suggestion on my tutorial.