---
title: "HTML – Frames"
url: https://khanwaseem.com/blog/course/html-frames
author: "khan Waseem"
published: 2023-09-20
updated: 2023-09-20
topics: ["course", "HTML Tutorial"]
description: "Explore HTML frames and their usage in web development. Learn about , , and elements and their roles in creating multi-sectioned web pages."
---

# HTML – Frames

In HTML, frame elements are used to divide a web page into multiple sections or frames, each of which can display different content. Frames were more commonly used in earlier web development but have become less common in modern web design due to various issues and limitations. However, it’s still valuable to understand how they work.

**Here are some key elements related to frames:**

- **`<frameset>` Element:** This is the container element used to define the layout of frames on a web page. It’s typically placed within the `<html>` element and can have attributes like `rows` or `cols` to specify the dimensions and arrangement of frames.

- **`<frame>` Element:** This element is used within the `<frameset>` element to define individual frames. Each `<frame>` element has attributes like `src` to specify the content to be displayed in the frame and `name` to give the frame a unique identifier.

- **`<iframe>` Element:** While not exactly the same as frames, `<iframe>` elements are often used to embed external web content within a page. They are more versatile and widely used in modern web development.

- **`<noframes>` Element:** This is used within the `<frameset>` element to provide alternative content for browsers that do not support frames. It’s helpful for accessibility and SEO.

Here’s a basic example of using frames:

```xml
<!DOCTYPE html>
<html>
<head>
    <title>Frames Example</title>
</head>
<frameset cols="25%, 75%">
    <!-- Left Frame: Navigation Menu -->
    <frame src="menu.html" name="menu">
    
    <!-- Right Frame: Content -->
    <frame src="content.html" name="content">
    
    <!-- Provide alternative content for non-frame browsers -->
    <noframes>
        <body>
            This page uses frames. Your browser does not support frames.
        </body>
    </noframes>
</frameset>
</html>
Code language: HTML, XML (xml)
```

**In this example:**

- We define a frameset with two columns using the `cols` attribute, with the left column taking up 25% of the width and the right column taking up 75%.

- Two `<frame>` elements are used to specify the content for each frame. The `src` attribute indicates the source file to be displayed in each frame. For example, “menu.html” and “content.html” would be replaced with the actual filenames or URLs.

- The `name` attribute is used to give each frame a unique name, which can be used for targeting links and forms to load content into specific frames.

- Inside the `<noframes>` element, we provide an alternative message that is displayed for browsers that do not support frames. This message informs users that the page uses frames and that their browser does not support them.

Please note that frames are not commonly used in modern web development due to various limitations and compatibility issues. Instead, web developers typically use more flexible layout techniques such as CSS to achieve similar designs while maintaining better compatibility and accessibility.

It’s important to note that frames are not commonly used in modern web development due to several drawbacks, including issues with search engine optimization (SEO), bookmarking, and accessibility. Instead, developers often use CSS and more advanced layout techniques to achieve similar effects while maintaining better compatibility and performance.

### Related posts:

[CSS – Table](https://blog.khanwaseem.com/css-table/)
[CSS – Border](https://blog.khanwaseem.com/css-border/)
[HTML – Tables](https://blog.khanwaseem.com/html-tables/)
[CSS – Text](https://blog.khanwaseem.com/css-text/)

Powered by [YARPP](https://yarpp.com).
