Frameset tag in HTML

M2-R5.1 · Chapter 3: HTML Basics · 2 min read

HTML FRAMESET TAG

<frameset> tag का उपयोग HTML के पुराने versions में browser window को multiple sections या panes में divide करने के लिए किया जाता था।

इसकी सहायता से एक ही browser window में अलग-अलग HTML documents को अलग-अलग sections में display किया जा सकता था।

उदाहरण के लिए, browser window को 4 parts में divide करके:

  • एक part में Menu

  • एक part में Header

  • एक part में Content

  • एक part में Footer

display किया जा सकता था।

📌 Important Note

<frameset> tag HTML5 में deprecated है और modern web development में supported नहीं है।

आज के समय में ऐसे layouts बनाने के लिए सामान्यतः CSS layouts, <iframe> या modern web layout techniques का उपयोग किया जाता है।


🔹 FRAMESET कैसे काम करता है?

<frameset> browser window को rows या columns में divide करता है।

इसके लिए मुख्य रूप से दो attributes का उपयोग किया जाता है:

  1. cols

  2. rows

cols Attribute

cols का उपयोग browser window को vertical columns में divide करने के लिए किया जाता है।

Example:

<frameset cols="50%,50%">

इससे browser window दो बराबर columns में divide हो जाएगी।

┌─────────────────┬─────────────────┐
│                 │                 │
│    Frame 1      │    Frame 2      │
│                 │                 │
└─────────────────┴─────────────────┘

rows Attribute

rows का उपयोग browser window को horizontal rows में divide करने के लिए किया जाता है।

Example:

<frameset rows="50%,50%">

इससे browser window दो बराबर rows में divide हो जाएगी।

┌───────────────────────────────┐
│            Frame 1            │
├───────────────────────────────┤
│            Frame 2            │
└───────────────────────────────┘

🔹 Syntax

<frameset cols="pixels|%|*">

    <!-- Define frames here -->

</frameset>

cols की जगह rows का भी उपयोग किया जा सकता है।


🔹 FRAME TAG

<frame> tag का उपयोग <frameset> के अंदर एक individual frame या browser window के section को define करने के लिए किया जाता है।

प्रत्येक <frame> में एक अलग HTML document load किया जा सकता है।

Example:

<frameset cols="50%,50%">

    <frame src="left.html">
    <frame src="right.html">

</frameset>

इस example में browser window दो parts में divide होगी और:

  • पहला frame → left.html

  • दूसरा frame → right.html

load करेगा।


🔹 ATTRIBUTES OF <FRAME> TAG

<frame> tag के मुख्य attributes निम्नलिखित हैं:

AttributeDescriptionExample
srcFrame में load होने वाले HTML document का URL या path specify करता है।<frame src="home.html">
nameFrame को एक name देता है, जिसका उपयोग links को किसी specific frame में open करने के लिए किया जा सकता है।<frame name="content">
scrollingFrame में scrollbar को control करता है। इसकी values yes, no या auto हो सकती हैं।<frame scrolling="auto">
noresizeUser को frame का size resize करने से रोकता है।<frame noresize>

🔹 FRAMESET में * का उपयोग

cols या rows में * का उपयोग available remaining space को automatically divide करने के लिए किया जा सकता है।

Example:

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

इसमें:

  • पहला frame → 30%

  • दूसरा frame → 70%

होगा।

एक और example:

<frameset cols="200,*">

इसमें:

  • पहला frame → 200 pixels

  • दूसरा frame → remaining available space

लेगा।


🔹 CREATE A HTML PAGE WITH 4 PARTS

Browser window को 4 equal parts में divide करने के दो methods देख सकते हैं।


METHOD 1 – Nested FRAMESET

इस method में एक बड़े <frameset> के अंदर दो छोटे <frameset> बनाए जाते हैं।

Code:

<html>

<head>
    <title>Formatting</title>
</head>

<frameset cols="50%,50%">

    <frameset rows="50%,50%">
        <frame src="page1.html">
        <frame src="page2.html">
    </frameset>

    <frameset rows="50%,50%">
        <frame src="page3.html">
        <frame src="page4.html">
    </frameset>

</frameset>

</html>

Structure:

┌───────────────────┬───────────────────┐
│                   │                   │
│     page1.html    │     page3.html    │
│                   │                   │
├───────────────────┤───────────────────┤
│                   │                   │
│     page2.html    │     page4.html    │
│                   │                   │
└───────────────────┴───────────────────┘

समझें:

सबसे पहले:

<frameset cols="50%,50%">

browser window को 2 columns में divide करता है।

फिर प्रत्येक column के अंदर:

<frameset rows="50%,50%">

का उपयोग करके उसे फिर से 2 rows में divide किया जाता है।

इस प्रकार total 4 frames बन जाते हैं।


METHOD 2 – ROWS और COLS का एक साथ उपयोग

इस method में एक ही <frameset> में cols और rows दोनों define किए जाते हैं।

Code:

<html>

<head>
    <title>Formatting</title>
</head>

<frameset cols="50%,50%" rows="50%,50%">

    <frame src="page1.html">
    <frame src="page2.html">
    <frame src="page3.html">
    <frame src="page4.html">

</frameset>

</html>

इससे browser window को 2 columns और 2 rows के अनुसार divide किया जाता है और total 4 frame areas बनाए जाते हैं।


🔹 FRAMESET का Real-World Example

पुराने websites में <frameset> का उपयोग अक्सर इस तरह किया जाता था:

┌──────────────────────────────────┐
│             Header               │
├──────────────┬───────────────────┤
│              │                   │
│    Menu      │      Content      │
│              │                   │
│              │                   │
├──────────────┴───────────────────┤
│             Footer               │
└──────────────────────────────────┘

एक frame में menu रखा जा सकता था और दूसरे frame में main content।

यदि menu में किसी link पर click किया जाता, तो उस link के target के अनुसार content दूसरे frame में open किया जा सकता था।

इसके लिए <frame> के name attribute और <a> tag के target attribute का उपयोग किया जाता था।

Example:

<frameset cols="25%,75%">

    <frame src="menu.html" name="menu">
    <frame src="home.html" name="content">

</frameset>

menu.html में:

<a href="about.html" target="content">About Us</a>

यह link about.html को content frame में open करेगा।


🔹 Important Points

  • <frameset> browser window को multiple sections में divide करता है।

  • <frame> एक individual section को define करता है।

  • cols browser window को columns में divide करता है।

  • rows browser window को rows में divide करता है।

  • src frame में load होने वाले document का path बताता है।

  • name frame को identify करने के लिए उपयोग होता है।

  • scrolling scrollbar को control करता है।

  • noresize frame को resize होने से रोकता है।

  • एक <frameset> के अंदर दूसरा <frameset> रखा जा सकता है, इसे Nested Frameset कहा जाता है।

  • <frameset> और <frame> पुराने HTML techniques हैं।

⚠️ Important Note

<frameset> और <frame> HTML5 में deprecated हैं। Modern web development में इनका उपयोग नहीं किया जाता। आज के समय में webpage layouts के लिए CSS और modern HTML elements का उपयोग किया जाता है।